azure-sdk-for-net
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 )
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
Thank you for your feedback. Tagging and routing to the team member best able to assist.
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