Unable to find user with upn with email address: user@domain.com

Viewed 897

I typed this cmd to grant permission for keyvault to access storage account with upn of my address (as the only user of the subscription) in order to manage storage access keys:

az keyvault set-policy -n keyvault02 --upn user@domain.com --storage-permissions get list delete set update regeneratekey getsas listsas deletesas setsas recover backup restore purge

but I faced this error message :

Unable to find user with upn 'user@domain.com'
Unable to get object id from principal name

Is there an issue with AD licence (requiring a particular licence) or something else?

Waiting for your help


If the question helped, up-vote it. Thanks in advance.

1 Answers

I can reproduce your issue: enter image description here


The User Principal Name in the portal maybe not the command used. This is my workaround:

# get user principal name(upn)
az ad user show --id {user-object-id}

enter image description here

# Give your user account permission to managed storage accounts    
az keyvault set-policy --name {the key vault name} --upn {the user principal name} --storage-permissions get list delete set update regeneratekey getsas listsas deletesas setsas recover backup restore purge

enter image description here

Related