Skip to content

Commit 36f23ac

Browse files
Merge pull request #299868 from mumian/0514-deployer-upn
update the deployer() function output
2 parents c50773a + d8908f5 commit 36f23ac

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

articles/azure-resource-manager/bicep/bicep-functions-deployment.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep functions - deployment
33
description: Describes the functions to use in a Bicep file to retrieve deployment information.
44
ms.topic: reference
55
ms.custom: devx-track-bicep
6-
ms.date: 02/12/2025
6+
ms.date: 05/16/2025
77
---
88

99
# Deployment functions for Bicep
@@ -14,18 +14,26 @@ This article describes the Bicep functions for getting values related to the cur
1414

1515
`deployer()`
1616

17-
Returns the information about the current deployment principal.
17+
Returns information about the principal (identity) that initiated the current deployment. The principal can be a user, service principal, or managed identity, depending on how the deployment was started.
1818

1919
Namespace: [az](bicep-functions.md#namespaces-for-functions).
2020

2121
### Return value
2222

23-
This function returns the information about the current deployment principal, including tenant ID and object ID.
23+
This function returns an object with details about the deployment principal, including:
24+
25+
- `objectId`: The Microsoft Entra ID object ID of the principal.
26+
- `tenantId`: The Microsoft Entra ID tenant ID.
27+
- `userPrincipalName`: The user principal name (UPN) if available. For service principals or managed identities, this property may be empty.
28+
29+
> [!NOTE]
30+
> The returned values depend on the deployment context. For example, `userPrincipalName` may be empty for service principals or managed identities.
2431
2532
```json
2633
{
27-
"objectId": "",
28-
"tenantId": ""
34+
"objectId": "<principal-object-id>",
35+
"tenantId": "<tenant-id>",
36+
"userPrincipalName": "<[email protected] or empty>"
2937
}
3038
```
3139

@@ -37,15 +45,18 @@ The following example Bicep file returns the deployer object.
3745
output deployer object = deployer()
3846
```
3947

40-
The preceding example returns the following object:
48+
Sample output (values differ based on your deployment):
4149

4250
```json
4351
{
4452
"objectId":"aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb",
45-
"tenantId":"aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e"
53+
"tenantId":"aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
54+
"userPrincipalName":"[email protected]"
4655
}
4756
```
4857

58+
For more information about Azure identities, see [What is an Azure Active Directory identity?](/azure/active-directory/fundamentals/active-directory-whatis).
59+
4960
## deployment
5061

5162
`deployment()`
@@ -141,7 +152,7 @@ The preceding example returns the following object:
141152

142153
`environment()`
143154

144-
Returns information about the Azure environment used for deployment. The `environment()` function is not aware of resource configurations. It can only return a single default DNS suffix for each resource type.
155+
Returns information about the Azure environment used for deployment. The `environment()` function isn't aware of resource configurations. It can only return a single default DNS suffix for each resource type.
145156

146157
Namespace: [az](bicep-functions.md#namespaces-for-functions).
147158

0 commit comments

Comments
 (0)