Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
377 stars 190 forks source link

Update Tags on VMSS vm #1299

Closed klyse closed 2 years ago

klyse commented 2 years ago

Query/Question How can I set custom tags on a virtual machine scale sets VM?

After reading through this issue I believe to understand that some very specific tasks cannot be accomplished using the C# fluent API and need to be done by directly calling the Azure RM API. I also think I found the appropriate endpoint to modify vmss vm's here.

When executing the PUT request on https://management.azure.com/subscriptions/<..>/resourceGroups/<..>/providers/Microsoft.Compute/virtualMachineScaleSets/vmss-uksouth/virtualMachines/4?api-version=2021-11-01

Body:

{
    "tags": {
        "TEST":"asd"
    }
}

Actual Result:

Response: HTTP 200

Body:

{
... other props
    "tags": {
        ... no new TEST tag; existing tags are returned
    }
... other props
}

Expected result:

Response: HTTP 200

Body:

{
... other props
    "tags": {
        "TEST":"asd"
    }
... other props
}

Why is this not a Bug or a feature Request?

I am unsure if setting tags on the vmss VM is possible or not.

Setup (please complete the following information if applicable):

weidongxu-microsoft commented 2 years ago

It appears service does not support it? Add tag on Portal gives error.

klyse commented 2 years ago

After communication with the Azure Support team I was informed that the service does not support it. The frontend seems to have the UI to set tags on VMSS vm's but it throws an error when saving it.

Closing this issue for now as it's not a problem of this lib.