Skip to content

How to get the principal id of the current principal executing the azure bicep deployment? #9969

Answered by jeskew
dazinator asked this question in Q&A
Discussion options

You must be logged in to vote

There's no function to get the principal ID of the user executing the deployment (though it is planned).

For your specific use case, though, such a function wouldn't help. The identity property of a deployment script can only specify a user-assigned managed service identity, however, so even if you had the ID of the user executing the deployment, you wouldn't be able to use that in the identity property of the deploymentScripts resource. You could always omit the identity property and then log in within the script itself using Connect-AzAccount (for a powershell script) or az login (for a CLI script), passing login credentials to the script as secure environment variables. There's some mo…

Replies: 4 comments 17 replies

Comment options

You must be logged in to vote
9 replies
@dazinator
Comment options

@brwilkinson
Comment options

@brwilkinson
Comment options

@LennDG
Comment options

@brwilkinson
Comment options

Answer selected by dazinator
Comment options

You must be logged in to vote
2 replies
@brwilkinson
Comment options

@brwilkinson
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@Welasco
Comment options

@rdf6
Comment options

@johndowns
Comment options

@seesharprun
Comment options

@NanoBob
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet