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

Redesign the Managed Identity public API #3970

Closed
Tracked by #3754
neha-bhargava opened this issue Feb 22, 2023 · 1 comment · Fixed by #3971
Closed
Tracked by #3754

Redesign the Managed Identity public API #3970

neha-bhargava opened this issue Feb 22, 2023 · 1 comment · Fixed by #3971

Comments

@neha-bhargava
Copy link
Contributor

neha-bhargava commented Feb 22, 2023

Add an application level API for managed identity:

var mi = ManagedIdentityApplicationBuilder  // This class will also have token cache behavior
  .Create() // Or .Create("user-assigned-managed-identity-guid")
  .Build();

AuthenticationResult result = await mi.AcquireTokenForManagedIdentity(scopes)  // This is the only method of this new class
  .ExecuteAsync().ConfigureAwait(false);

Ref: https://identitydivision.visualstudio.com/DevEx/_git/AuthLibrariesApiReview/pullrequest/7003?_a=files&path=/ManagedIdentity/ManagedIdentity.md

@neha-bhargava neha-bhargava changed the title Implement the API proposal 5 from API review doc and change the tests - 2 weeks + 2 weeks as buffer for surprises Implement the API proposal 5 from API review doc Feb 22, 2023
@gladjohn gladjohn added this to the 4.51.0 milestone Feb 22, 2023
@neha-bhargava neha-bhargava mentioned this issue Feb 22, 2023
1 task
@bgavrilMS bgavrilMS changed the title Implement the API proposal 5 from API review doc Redesign the Managed Identity public API Feb 27, 2023
@pmaytak
Copy link
Contributor

pmaytak commented Mar 7, 2023

Will this from the spec be implemented? I guess not?

When using a normal confidential client federated by Managed Identity, there are several sub-options here.

var cca = ConfidentialClientApplicationBuilder()
  .Create(clientId)  // The normal CCA's client id
  .WithManagedIdentity()  // Or .WithManagedIdentity("user-assigned-managed-identity-guid")
  ...  // Other modifiers needed by a normal CCA, such as WithAuthority(...)
  .Build();
var result1 = await cca.AcquireTokenForClient("https://graph.microsoft.com/.default")  // Same as a normal CCA
  .ExecuteAsync().ConfigureAwait(false);  // It will create and call ManagedIdentityApplication object internally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants