Search code examples
pythonazureservice-principal

Difference between key credentials and password credentials for Azure Service Principal?


I'm programmatically creating Azure application and service principal registrations using Python and have been asked to provide a client secret for the apps as well.

In the ServicePrincipalsUpdateParameters class, it looks like I have the option to update password_credentials and key_credentials. Can anyone explain the difference between the two?


Solution

  • The PasswordCredentials are for, well, passwords. They are text strings.

    The KeyCredentials are for authenticating with a certificate. To be precise, the key credential contains the cert's public key, corresponding to this pane in the Azure Portal (AAD -> App registrations -> Certificates & secrets):

    enter image description here