You can use the /addPassword endpoint for that: https://learn.microsoft.com/en-us/graph/api/application-addpassword?view=graph-rest-beta&tabs=http
Can I generate Azure AD Client Credentials Secrets using an API?
Vinay Shiva
1
Reputation point
I want to use my Azure AD App Registration to create multiple Client Secrets. I saw that I can do it manually. However, I want to be able to do the same programmatically through an API. That brings me to the following 2 questions:
- Is there an API (Graph, or any other) which I can use to automate generation and deletion of the Client Secrets?
- Is there a limit on how many Client Secrets there can be within a single app?
Microsoft Security | Microsoft Entra | Microsoft Entra ID
25,130 questions
2 answers
Sort by: Most helpful
-
Vasil Michev 119.6K Reputation points MVP Volunteer Moderator
2021-05-14T17:37:39.8+00:00 -
Marco von Hagen 6 Reputation points
2021-05-14T18:10:46.533+00:00 You can use PowerShell like so:
New-AzureADApplicationPasswordCredential -ObjectId "YourAppObjectId"
Response:
CustomKeyIdentifier : EndDate : 9/28/2017 3:57:10 PM KeyId : StartDate : 9/28/2016 3:57:10 PM Value : ZJ0V1Yg4cp4eWIey9DrYspqVdX1pdvY437P/ueGxVLU=
Find more in the [MSFT DOCS] (https://learn.microsoft.com/en-us/powershell/module/azuread/new-azureadapplicationpasswordcredential?view=azureadps-2.0#example-1--create-a-password-credential)