azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[QUERY] How to set UserAssignedManagedIdentity to a VM that is created using new Azure SDK ( Azure.ResourceManager.Compute )

Open juanvicfer opened this issue 1 year ago • 1 comments
trafficstars

Library name and version

Azure.ResourceManager.Compute 1.4.0

Query/Question

I have an app that runs in a pool of VirtualMachines that are created using a C# App using new Azure .NET SDK ( Azure.ResourceManager.Compute ). I want to assign a UserAssignedManageIdentity to the VMs. I know how to do it using Azure's web interface and using old fluent SDK ( WithExistingUserAssignedManagedServiceIdentity ), but I haven't found how to do it using the new library.

Environment

Windows 10 .NET Framework 4.7.2

juanvicfer avatar May 15 '24 12:05 juanvicfer

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar May 15 '24 13:05 jsquire

I found it. Setting VirtualMachineData.Identity made it work. Thanks for your support! https://github.com/Azure/azure-sdk-for-net/blob/867aa6159e48b20e86ea14fa3e7b2324eb2f7ed3/sdk/compute/Azure.ResourceManager.Compute/samples/Generated/Samples/Sample_VirtualMachineCollection.cs#L1075

juanvicfer avatar May 23 '24 14:05 juanvicfer