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

[identity] Use MSAL for Managed Identity #30172

Merged
merged 13 commits into from
Jul 16, 2024

Conversation

maorleger
Copy link
Member

@maorleger maorleger commented Jun 25, 2024

Packages impacted by this PR

@azure/identity

Issues associated with this PR

Resolves #25253

Describe the problem that is addressed by this PR

With MSAL implementing Managed Identity via the ManagedIdentityApplication, we
want to migrate our existing legacy implementation to use MSAL instead.

This PR:

  • Creates a msalMsiProvider that implements the MSAL MSI flow
  • Moves ManagedIdentityCredential to use msalMsiProvider under the hood

Some implementation details:

  • TokenExchangeMsi is not supported by MSAL and we expect to continue
    supporting it as a special handler
  • IMDS probing is not supported by MSAL and we expect to continue probing and
    failing-fast as a special handler

Provide a list of related PRs (if any)

#30045

Checklists

  • Added impacted package name to the issue description.
  • Does this PR need any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here.)
  • Added a changelog (if necessary).

Manual validation

  1. Every scenario runs against GA identity and this PR
  2. Every scenario runs using DAC and MI directly
scenario result notes
Azure VM pass
Azure Kubernetes pass only user assigned MI so far
Azure Functions pass
Azure WebApps pass
Azure Cloud Shell

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@maorleger maorleger force-pushed the msal-managed-identity-migration branch from 0386a63 to 10c5c4d Compare June 25, 2024 21:54
@KarishmaGhiya
Copy link
Contributor

Overall the PR is coming along great. I have a few questions to discuss:

  • Does MSAL have support for these - CloudShell, Azure Arc, App Configuration 2019? (i didn't see the isAvailable function for these scenarios in this file sdk/identity/identity/src/credentials/managedIdentityCredential/msalMsiProvider.ts
  • What is the default value for allowInsecureConnections? Where is that mentioned?
  • We are not giving the user the ability to switch back to legacy implementation right?

@maorleger
Copy link
Member Author

maorleger commented Jun 25, 2024

  • Does MSAL have support for these - CloudShell, Azure Arc, App Configuration 2019? (i didn't see the isAvailable function for these scenarios in this file sdk/identity/identity/src/credentials/managedIdentityCredential/msalMsiProvider.ts
  • What is the default value for allowInsecureConnections? Where is that mentioned?
  • We are not giving the user the ability to switch back to legacy implementation right?
  • That is correct. My understanding is that we will not be following the env var approach as per our team discussions

Let me know if you have any more questions! Happy to check my understanding

@maorleger maorleger force-pushed the msal-managed-identity-migration branch from b35c4e2 to b267afd Compare June 26, 2024 16:34
Copy link
Member

@xirzec xirzec left a comment

Choose a reason for hiding this comment

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

Nice! I like that the legacy implementation is able to be brought back until we're confident we can delete that code.

@maorleger maorleger force-pushed the msal-managed-identity-migration branch 2 times, most recently from e60460e to a0c72fd Compare July 5, 2024 21:39
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@maorleger
Copy link
Member Author

FYI planning to merge this today regardless so please do review by EOD

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

1 similar comment
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@maorleger maorleger merged commit 1d9920a into Azure:main Jul 16, 2024
14 checks passed
@maorleger maorleger deleted the msal-managed-identity-migration branch July 16, 2024 22:54
maorleger added a commit that referenced this pull request Aug 8, 2024
### Packages impacted by this PR

@azure/core-util

### Issues associated with this PR

Contributes to #30187

### Describe the problem that is addressed by this PR

Ports over the logic from @azure/core-rest-pipeline's
exponentialRetryStrategy
to a helper function that can be used by client libraries.

This code was duplicated in @azure/identity and a partner team attempted
to add exponential-backoff as a dependency to add support for this logic.

A helper function can be used to calculate the next interval, leaving
the business logic / deciding what to do next to the specific usecase

### Provide a list of related PRs _(if any)_

#30172 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Use MSAL for managed identity token requests
5 participants