I'm running a python script, where o want to use service principal to authenticate. I don't want to store service principal secret in my script.
Please help me to store the secret key somewhere and access it dynamically in the script using az cli commands.
I need some command which can fetch the secret key runtime and I can pass it to
"az login --servicePrincipal" command.
I tried to reproduce the same in my environment and got the results successfully like below:
I registered an Azure AD application and generated
client_secret:To store the above secret key of the, I created an Azure Key Vault like below:
Go to Azure Key Vault -> Your Vault -> Secrets -> Generate/Import -> Create
To fetch the Service Principal secret key via Azure CLI, please try the below commands: