Replies: 2 comments 3 replies
-
|
@MDAG21 have you looked at https://learn.microsoft.com/en-us/community/content/microsoft-graph-bicep-extension? I doubt that the Bicep team will come with something that does the same thing like the Graph extension. Role definitions are Azure resource thus why they did az.roleDefinitions(). Entra objects are not Azure resource thus the Graph extension. |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
Instead if displayName this should use uniqueName that was added when Graph API bicep extension was added. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
az.principal()— Resolve Entra ID object IDs by display name at deploy time (analogous toaz.roleDefinitions())Problem
When authoring role assignments in Bicep, it is common to need the object ID of an Entra ID principal — a security group, user, or service principal — as the
principalId. Today there is no way to resolve this by name; authors must look up the GUID out-of-band and hardcode it:This friction causes several problems:
xxxxxxxx-xxxx-...refers to without a commentPrecedent —
az.roleDefinitions()PR #18457 solved exactly this pattern for RBAC role definitions. Before, authors had to hardcode role definition GUIDs:
After, a name-based runtime function resolves the GUID for them:
The implementation in
AzNamespaceType.csis clean — aFunctionOverloadBuilderdeclaration whose result is populated at ARM runtime:The same pattern should be applicable to Entra ID principals.
Proposed Solution
Add a new
az.principal()function to theaznamespace that resolves an Entra ID principal's object ID by display name or UPN at ARM deployment time.Proposed Bicep syntax
Proposed return type
Proposed
AzNamespaceType.csdeclarationUpdated authoring experience
Implementation Considerations
ARM engine — Graph API access
The main dependency is whether the ARM deployment engine can invoke the Microsoft Graph API during template evaluation, the same way it resolves role definition names today. ARM already has Graph access in some scenarios (e.g., AAD admin assignment for SQL). A scoped
Microsoft.Graph/principalsread would be the minimal permission surface.Alternative: Microsoft Graph extensibility provider
If ARM-native resolution is not feasible, this could instead be surfaced as part of the
microsoftgraphBicep extensibility provider as a read-only lookup function rather than a full resource deployment:Ambiguity handling
Display names in Entra ID are not guaranteed to be unique. The function should:
typeparameter ('Group','User','ServicePrincipal') to disambiguate:Motivation Summary
az.principal()az.roleDefinitions()This follows the exact same philosophy as
az.roleDefinitions()and would eliminate the last remaining category of "magic GUIDs" in Bicep role assignment authoring.Beta Was this translation helpful? Give feedback.
All reactions