相关文章推荐
文武双全的自行车  ·  python ...·  2 天前    · 
淡定的地瓜  ·  python ...·  2 天前    · 
风流的冰淇淋  ·  ‘gpedit.msc‘ ...·  9 月前    · 
失落的木瓜  ·  ssl - I got an error ...·  1 年前    · 
憨厚的鼠标  ·  javascript - jest ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Azure KeyVault: how to retrieve clientId, clientSecret and the tenantId for an existing Service Principal?

Ask Question

The cloud engineer in my organization has set up an Azure KeyVault and a Service Principal. I know the id of this Service Principal, but I also need clientId , clientSecret , and tenantId .

The documentation shows that these variables are exposed to you when you create a Service Principal using Azure CLI, but in my case, there is one already. I don't have the credentials to create a new one, and frankly speaking, I don't need to.

So, how can I retrieve the clientId , clientSecret , and tenantId associated with the existing Service Principal?

Client id and tenant id you can get, but client secret you cannot retrieve. It is shown once when the secret is created and can't be read from anywhere. You need a new secret if it is not available. juunas Mar 4, 2021 at 10:31

You can get the Service Principal's Client Id and Tenant Id using CLI command like below:

az ad sp list --query "[].{id:appId, tenant:appOwnerTenantId}"

You can even get many more values of the Service Principals - refer to ServicePrincipalInner class.

Further, as mentioned in the comments, you cannot retrieve the Client Secret created by somebody else. You will have to reset it:

az ad sp credential reset --name APP_ID
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.