[Profile] Fix "missing secret or certificate in order to authenticate through a service principal" #16219
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
After logging in with a Service Principal using a certificate, 2 commands
az account show --sdk-authaz account list --refreshwill fail with
This is because
retrieve_secret_of_service_principalcan only return asecret, butNoneforcertificateFile, causing subsequentServicePrincipalAuthinstantiation to fail due to the lack ofpassword_arg_value.This PR fixes these commands by:
retrieve_secret_of_service_principaltoretrieve_cred_for_service_principalto reflect its actual functionality.retrieve_cred_for_service_principalreturnsecretorcertificateFileof the Service Principal so thatServicePrincipalAuthgets what it needs.Testing Guide
To repro:
After the fix: