Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/azure-cli-core/azure/cli/core/auth/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@


class Identity: # pylint: disable=too-many-instance-attributes
"""Class to manage identities:
- user
- service principal
- TODO: managed identity
"""Manage user or service principal identities and log into Microsoft identity platform.
"""

# MSAL token cache.
Expand Down Expand Up @@ -199,12 +196,6 @@ def login_with_service_principal(self, client_id, credential, scopes):
entry = sp_auth.get_entry_to_persist()
self._service_principal_store.save_entry(entry)

def login_with_managed_identity(self, scopes, identity_id=None): # pylint: disable=too-many-statements
raise NotImplementedError

def login_in_cloud_shell(self, scopes):
raise NotImplementedError
Comment on lines -205 to -206
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to remove login_in_cloud_shell Since cloud_shell is a special user identity in msal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't agree with MSAL's design, see #29637 (comment), #29637 (comment) for detailed explanations.

I want to keep the calling pattern for Identity consistent - authority should always be a required parameter.

For Cloud Shell authentication, the CLI command is az login --identity. It is a managed identity credential, no matter what token is returned. Including CloudShellCredential in Identity blurs its boundary.


def logout_user(self, username):
# If username is an SP client ID, it is ignored
accounts = self._msal_app.get_accounts(username)
Expand Down Expand Up @@ -251,9 +242,6 @@ def get_service_principal_credential(self, client_id):
client_credential = ServicePrincipalAuth(entry).get_msal_client_credential()
return ServicePrincipalCredential(client_id, client_credential, **self._msal_app_kwargs)

def get_managed_identity_credential(self, client_id=None):
raise NotImplementedError


class ServicePrincipalAuth: # pylint: disable=too-many-instance-attributes
def __init__(self, entry):
Expand Down