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

Read-only Implementation of Managed Identities #933

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

nturinski
Copy link
Member

@nturinski nturinski commented Sep 30, 2024

TODO: I'll add more description tomorrow. Already kind of late.

There is a bug right now-- because the scope id I'm using to determine the app type is just an Azure id string, it can't tell the difference between app service and functions.

I could do something like retrieving that resource when we see a Microsoft.site provider, but that kind of seems like overkill at this point.

image

@nturinski nturinski marked this pull request as ready for review October 2, 2024 01:02
@nturinski nturinski requested a review from a team as a code owner October 2, 2024 01:02
Copy link
Contributor

@MicroFish91 MicroFish91 left a comment

Choose a reason for hiding this comment

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

Love this new view, going to be super useful for working with identities going forward 🥳

async getChildren(element: ResourceGroupsItem): Promise<ResourceGroupsItem[] | null | undefined> {
return (await element.getChildren?.())?.map((child) => {
if (child.id) {
return ext.azureTreeState.wrapItemInStateHandling(child, () => this.refresh(child))
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for my own understanding, is it safe to say that all resource tree items need to be returned wrapped? I'm guessing child.id being defined would only happen in the case that the item had not yet been wrapped, hence check for that to determine if we need to wrap.

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 may not actually need the id check, I think I was just imitating something. I'll remove it.

As for what it's actually doing, I think the state handling stuff is due to a weird issue in VS Code where it only records the initial state of a tree node, but doesn't keep track of it.

Alex and Brandon had to do this to fix some bug about loading all of a tree's children only if the tree was expanded.

iconPath = getIconPath(getAzExtResourceType({ type: parsedAzureResourceId.provider }));
}
catch (error) {
// if this fails, then it was a resource group ID
Copy link
Contributor

@MicroFish91 MicroFish91 Dec 4, 2024

Choose a reason for hiding this comment

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

I think this could also fail if the scope is a subscription ID, so might need a fallback for that scenario as well (otherwise the user might see an ID parsing error).

@@ -101,6 +101,7 @@ const azExtDisplayInfo: Partial<Record<AzExtResourceType, AzExtResourceTypeDispl
Images: { displayName: localize('images', 'Images') },
LoadBalancers: { displayName: localize('loadBalancers', 'Load balancers') },
LogicApp: { displayName: localize('logicApp', 'Logic App') },
ManagedIdentityUserAssignedIdentities: { displayName: localize('managedIdentity', 'Managed Identity (Read-Only)') },
Copy link
Contributor

@MicroFish91 MicroFish91 Dec 4, 2024

Choose a reason for hiding this comment

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

Would it be useful / is there a good way for us to indicate (maybe as like a description) that the Managed Identities group is specifically for user-assigned identities?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe instead of (Read-Only) change it to:

Managed Identity (User Assigned)

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.

2 participants