How can I use AZ commands to create client secret the same way I can do it from the portal?
How to generate client secret in azure app registration in Azure AD from CLI?
You are looking for az ad app credential reset
, it appends or overwrites an application's password(i.e. client secret
) or certificate credentials.
az ad app credential reset --id
[--append]
[--cert]
[--create-cert]
[--credential-description]
[--end-date]
[--keyvault]
[--password]
[--years]
Sample(you can also specify other parameters, it depends on you):
az ad app credential reset --id xxxxxxxxxxxx --append
What exactly does append do? Will it create a second secret? –
Wheatear
@Wheatear yes it creates an additional client secret every time you run it with --append –
Mange
I get "Property identifierUris is invalid." no matter if I use powershell (AzureAD) or the Cli :/ –
Waw
Just in case anyone is equally confused, there can be a lag between running this command, and the new secret being visible in the Azure Portal. Also, you can use
--display-name
to set a Description. –
Marchesa Get ID Client of app register for example: "appId": "b23e2416-xxxx-xxxx-98d4"
Create:
az ad app credential reset --id b23e2416-xxxx-xxxx-98d4 --append \
--display-name 'Description: Secret Bolivian client' --end-date '2024-12-31'
Output:
The output includes credentials that you must protect.
Be sure that you do not include these credentials in your code or check the credentials into your source control.
For more information, see https://aka.ms/azadsp-cli
{
"appId": "b23e2416-xxxx-xxxx-98d4",
"password": "rp28Q~VNlFt-xxxxxxxxxxxxxxxxxxxxxxx",
"tenant": "67f3b853-xxxx-xxxx-xxxx"
}
© 2022 - 2025 — McMap. All rights reserved.