Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #11458: az ad sp credential reset doesn't reset service principal credential, resets app credential #11466

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
fixed style errors
  • Loading branch information
Mike Liddle committed Dec 3, 2019
commit deb5aa2297e8b5b46b44f279152db3ba6cb51d6e
8 changes: 4 additions & 4 deletions src/azure-cli/azure/cli/command_modules/role/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ def _get_service_principal_credentials(graph_client, sp_object_id, cert=False):

def delete_application_credential(cmd, identifier, key_id, cert=False):
graph_client = _graph_client_factory(cmd.cli_ctx)

app_object_id = _resolve_application(graph_client.applications, identifier)
result = _get_application_credentials(graph_client, app_object_id, cert)

Expand All @@ -1198,7 +1198,7 @@ def delete_application_credential(cmd, identifier, key_id, cert=False):

def delete_service_principal_credential(cmd, identifier, key_id, cert=False):
graph_client = _graph_client_factory(cmd.cli_ctx)

sp_object_id = _resolve_service_principal(graph_client.service_principals, identifier)
result = _get_service_principal_credentials(graph_client, sp_object_id, cert)

Expand Down Expand Up @@ -1575,7 +1575,7 @@ def reset_service_principal_credential(cmd, name, password=None, create_cert=Fal
end_date=None, keyvault=None, append=False, credential_description=None):
client = _graph_client_factory(cmd.cli_ctx)

#pylint: disable=no-member
# pylint: disable=no-member
app_start_date = datetime.datetime.now(TZ_UTC)
if years is not None and end_date is not None:
raise CLIError('usage error: --years | --end-date')
Expand Down Expand Up @@ -1688,7 +1688,7 @@ def reset_application_credential(cmd, name, password=None, create_cert=False, ce
'more than one entry matches the name, please provide unique names like '
'app id guid, or app id uri')
app = (show_application(client.applications, name) if aad_sps else
show_application(client.applications, name)) # possible there is no SP created for the app
show_application(client.applications, name)) # possible there is no SP created for the app

if not app:
raise CLIError("can't find an application matching '{}'".format(name))
Expand Down