Description
openedon Jul 31, 2024
Describe the bug
It seems that the updated tags for disks are not yet visible in API when az expects them to be already visible. I suspect this is some kind of caching problem on the Azure API side of things.
I start out with two resources, one managed disk, one VM
the Tag set before I update it via az tag update
is "TestKey": "TestValue"
then I update the tag via replacing tags, for the vm it shows correctly the new tag, for the disk it shows the old tag. New tag is "TestKey": "TestValueUpdated"
-- I've annotated the output for better visiblity below.
after a couple of seconds I do a az tag list
again and you can see the tag was actually updated properly.
I've looked at the debug output, the actual api response after the post operation is showing the wrong tag value.
Related command
az tag update
Errors
There is no error message, the output of the API request is simply wrong.
Issue script & Debug output
$ az tag list --resource-id /subscriptions/subscription_id/resourceGroups/resource_group/providers/Microsoft.Compute/disks/vm_name_OsDisk_1_2b5931e6aa944f09b3e5fdb548475e72
{
"id": "/subscriptions/subscription_id/resourceGroups/resource_group/providers/Microsoft.Compute/disks/vm_name_OsDisk_1_2b5931e6aa944f09b3e5fdb548475e72/providers/Microsoft.Resources/tags/default",
"name": "default",
"properties": {
"tags": {
"TestKey": "TestValue"
}
},
"resourceGroup": "resource_group",
"type": "Microsoft.Resources/tags"
}
$ az tag list --resource-id /subscriptions/subscription_id2/resourceGroups/resourcegroup_2/providers/Microsoft.Compute/virtualMachines/vm_name_2
{
"id": "/subscriptions/subscription_id2/resourceGroups/resourcegroup_2/providers/Microsoft.Compute/virtualMachines/vm_name_2/providers/Microsoft.Resources/tags/default",
"name": "default",
"properties": {
"tags": {
"TestKey": "TestValue"
}
},
"resourceGroup": "resourcegroup_2",
"type": "Microsoft.Resources/tags"
}
$ az tag update --operation replace --resource-id /subscriptions/subscription_id/resourceGroups/resource_group/providers/Microsoft.Compute/disks/vm_name_OsDisk_1_2b5931e6aa944f09b3e5fdb548475e72 --tags 'TestKey=TestValueUpdated'
{
"id": "/subscriptions/subscription_id/resourceGroups/resource_group/providers/Microsoft.Compute/disks/vm_name_OsDisk_1_2b5931e6aa944f09b3e5fdb548475e72/providers/Microsoft.Resources/tags/default",
"name": "default",
"properties": {
"tags": {
"TestKey": "TestValue" #### <<--- the old value instead of the new value
}
},
"resourceGroup": "resource_group",
"type": "Microsoft.Resources/tags"
}
$ az tag update --operation replace --resource-id /subscriptions/subscription_id2/resourceGroups/resourcegroup_2/providers/Microsoft.Compute/virtualMachines/vm_name_2 --tags 'TestKey=TestValueUpdated'
{
"id": "/subscriptions/subscription_id2/resourceGroups/resourcegroup_2/providers/Microsoft.Compute/virtualMachines/vm_name_2/providers/Microsoft.Resources/tags/default",
"name": "default",
"properties": {
"tags": {
"TestKey": "TestValueUpdated" #### <<--- here it is already the new value
}
},
"resourceGroup": "resourcegroup_2",
"type": "Microsoft.Resources/tags"
}
$ az tag list --resource-id /subscriptions/subscription_id/resourceGroups/resource_group/providers/Microsoft.Compute/disks/vm_name_OsDisk_1_2b5931e6aa944f09b3e5fdb548475e72
{
"id": "/subscriptions/subscription_id/resourceGroups/resource_group/providers/Microsoft.Compute/disks/vm_name_OsDisk_1_2b5931e6aa944f09b3e5fdb548475e72/providers/Microsoft.Resources/tags/default",
"name": "default",
"properties": {
"tags": {
"TestKey": "TestValueUpdated"
}
},
"resourceGroup": "resource_group",
"type": "Microsoft.Resources/tags"
}
$ az tag list --resource-id /subscriptions/subscription_id2/resourceGroups/resourcegroup_2/providers/Microsoft.Compute/virtualMachines/vm_name_2
{
"id": "/subscriptions/subscription_id2/resourceGroups/resourcegroup_2/providers/Microsoft.Compute/virtualMachines/vm_name_2/providers/Microsoft.Resources/tags/default",
"name": "default",
"properties": {
"tags": {
"TestKey": "TestValueUpdated"
}
},
"resourceGroup": "resourcegroup_2",
"type": "Microsoft.Resources/tags"
}
Expected behavior
Show the updated tag correctly
Environment Summary
$ az --version
azure-cli 2.62.0
core 2.62.0
telemetry 1.1.0
Extensions:
resource-graph 2.1.0
Dependencies:
msal 1.28.1
azure-mgmt-resource 23.1.1
Python location '/usr/bin/python3.9'
Extensions directory '/home/username/.azure/cliextensions'
Python (Linux) 3.9.19 (main, May 16 2024, 08:45:40)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-22)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response