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

Add support for Managed Identity #108

Merged
merged 8 commits into from
Dec 5, 2023
Merged

Conversation

JoshLozensky
Copy link
Contributor

Add support for Managed Identity

Added ManagedIdentity as a CredentialType

Description

Added Managed Identity to the Credential Type, Description, and Source classes. Created a new class ManagedIdentityOptions with the three relevant fields ClientId, ObjectId, and HostResourceId

Fixes #1775 #2551

@JoshLozensky JoshLozensky marked this pull request as draft November 23, 2023 00:36
Copy link
Contributor

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

The design is to have a property of type ManagedIdentityOptions on AcquireTokenOptions, not to change CredentialSource/CredentialDescription

Copy link
Contributor

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

Thanks @JoshLozensky

There are a few things to change, but this looks good already!

Copy link
Contributor

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

@JoshLozensky
this is a really good proposal!

I'm still hesitant about the verbosity. I personally prefer shorter expressions, and a pay as you go approach: I want to use managed identity, but default it's a system assigned one, so I'll just say "Managed identity". then if I've made more effort and created a user-assigned managed identity I know the client ID and I can provide the ID.

For the programmatic approach, static methods:

ManagedIdentityDescription.FromUserAssignedObjectId(string) etc, could also help.

Copy link
Member

@bgavrilMS bgavrilMS left a comment

Choose a reason for hiding this comment

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

I agree with @jmprieur 's proposals. Will review again once those are taken into consideration.

PS: naming is hard. we had endless discussions about this in MSAL .NET and MSAL JS as well.

Copy link
Contributor

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks @JoshLozensky

@jennyf19
Copy link
Collaborator

jennyf19 commented Dec 1, 2023

using System;

license info needs to be added for all new files.


Refers to: src/Microsoft.Identity.Abstractions/ManagedIdentity/ManagedIdentityType.cs:1 in 11fde20. [](commit_id = 11fde20, deletion_comment = False)

@jennyf19
Copy link
Collaborator

jennyf19 commented Dec 1, 2023

using System;

are all the usings needed?


In reply to: 1835478327


Refers to: src/Microsoft.Identity.Abstractions/ManagedIdentity/ManagedIdentityType.cs:1 in 11fde20. [](commit_id = 11fde20, deletion_comment = False)

@JoshLozensky JoshLozensky force-pushed the lozensky/AddMsiSupport branch from d68ac8b to e560977 Compare December 1, 2023 20:55
@JoshLozensky JoshLozensky marked this pull request as ready for review December 1, 2023 20:56
Copy link
Contributor

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks @JoshLozensky

A few more fixes to do (per the compiler)

Copy link
Collaborator

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

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

Approving as @JoshLozensky and I discussed offline on the few remaining comments.
:shipit:

@JoshLozensky JoshLozensky merged commit 18373a3 into main Dec 5, 2023
4 checks passed
@JoshLozensky JoshLozensky deleted the lozensky/AddMsiSupport branch December 5, 2023 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants