Azure-docs: Is the Object Id of Azure Key Vault actually global?

Created on 31 Jul 2019  Â·  5Comments  Â·  Source: MicrosoftDocs/azure-docs

I was trying to setup the Key Vault to manage my storage account keys using Azure CLI. I already have an existing Key Vault and a storage account. These are the steps I followed:

  • az login
    > Logged in Successfully using User ID
  • az role assignment create --role "Storage Account Key Operator Service Role" --assignee-object-id 93c27d83-f79b-4cb2-8dd4-4aa716542e74 --scope "/subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Storage/storageAccounts/<storageAccountName"
    > Output: Principal 93c27d83f79b4cb28dd44aa716542e74 does not exist in the directory xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

I then went to the Azure Portal and looked up the Object Id for Azure Key vault in: Azure Active Directory -> Enterprise Applications -> All Application -> "Set Application Type" as "All Applications". There I noticed that the Object Id for Azure Key vault is different from one mentioned here but the "Application Id" is the same as listed in the article above.

It could benefit to update the article to not make the generalization that, quoting from the article: "93c27d83-f79b-4cb2-8dd4-4aa716542e74 is the Object ID for Key Vault in the Azure public cloud." and provide the commands to lookup the Object Id. I also noticed that there is an "Example Output" showing the Object Id but the command is missing.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author doc-enhancement key-vaulsvc triaged

Most helpful comment

The Azure CLI won't resolve the Application ID of Key Vault to the Object ID. The principal ID for Key Vault in my instance is e2c1b8c7-4000-45a5-80d1-65d2bce927aa. I don't know if that is universal. In the meantime, you can simply use az role assignment create --role "Storage Account Key Operator Service Role" --assignee 'https://vault.azure.net' --scope $sa_id instead of using the Object Id.

All 5 comments

@sln007 Thanks for your Feedback! We will investigate this and get back to you as soon as possible,

@sln007 Thanks for the feedback ! I have assigned this issue to content author to investigate and update the document as appropriate.

The Azure CLI won't resolve the Application ID of Key Vault to the Object ID. The principal ID for Key Vault in my instance is e2c1b8c7-4000-45a5-80d1-65d2bce927aa. I don't know if that is universal. In the meantime, you can simply use az role assignment create --role "Storage Account Key Operator Service Role" --assignee 'https://vault.azure.net' --scope $sa_id instead of using the Object Id.

the article mentions, the object id is common for azure public. In reality it is application name which is common. Object Id for Key Vault can be fetched from Registered Enterprise Applications and with "All Application" and start with "Azure" filter.

Using assignee instead works universally for public cloud. Document updated to us that instead --assignee 'https://vault.azure.net'

please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

varma31 picture varma31  Â·  3Comments

AronT-TLV picture AronT-TLV  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

mrdfuse picture mrdfuse  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments