22

How can I use AZ commands to create client secret the same way I can do it from the portal? Creating client secret from portal

Ahmed Mohamed
  • 464
  • 1
  • 4
  • 13

1 Answers1

29

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

enter image description here

Joy Wang
  • 39,905
  • 3
  • 30
  • 54
  • What exactly does append do? Will it create a second secret? – Nicolai Sep 11 '19 at 05:55
  • 2
    @Nicolai yes it creates an additional client secret every time you run it with --append – alv Jan 10 '20 at 20:24
  • 1
    I get "Property identifierUris is invalid." no matter if I use powershell (AzureAD) or the Cli :/ – Johan Danforth Nov 16 '21 at 22:48
  • 1
    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. – Mike Mar 29 '23 at 15:36