Azure / azure-cli

Azure Command-Line Interface
MIT License
4k stars 2.98k forks source link

az resource tag failing to update General Purpose V2 SQL Managed Instance #30095

Open zoeperryman opened 5 days ago

zoeperryman commented 5 days ago

Describe the bug

Attempting to update the tags on a General Purpose V2 SQL Managed Instance fails using az resource tag. The managed instance itself is deployed and updated via bicep templates, but at the end of our deployment script we update some tags on it.

Command az resource tag -g MyGroup -n MyServer --tags MyTag=TagValue --resource-type "Microsoft.Sql/managedInstances"

Errors:

(GPTargetEditionAndUnspecifiedGPV2NotAllowedInUpdateOFGPV2MI) Combination of General Purpose target edition (sku.name/sku.tier parameters) and unspecified value for the isGeneralPurposeV2 parameter is not allowed in the update operation of General Purpose V2 Managed Instance.
Code: GPTargetEditionAndUnspecifiedGPV2NotAllowedInUpdateOFGPV2MI
Message: Combination of General Purpose target edition (sku.name/sku.tier parameters) and unspecified value for the isGeneralPurposeV2 parameter is not allowed in the update operation of General Purpose V2 Managed Instance.

Server Details Running az sql mi show on the managed instance shows the following details (snipped to just relevant details)

{
  "isGeneralPurposeV2": true,
  "sku": {
    "capacity": 4,
    "family": "Gen5",
    "name": "GP_Gen5",
    "size": null,
    "tier": "GeneralPurpose"
  },
  "storageIops": 6144,
  "storageSizeInGb": 2048,
  "storageThroughputMbps": 145,
}

We can see that the error is complaining that there is an unspecified value for the isGeneralPurposeV2 parameter. I'm not sure what the command is doing internally and why updating tags is triggering this, but you can see that the isGeneralPurposeV2 is specified on the current server details.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

Tags are updated without an error being raised.

This works correctly on our non-V2 managed instances, or though I notice that updating the tags seems to trigger a scaling event instead of just adding some tags.

Environment Summary

Windows-10-10.0.22631-SP0
Python 3.11.8
Installer: MSI

azure-cli 2.65.0

Extensions:
datafactory 1.0.0
datamigration 1.0.0b1
maintenance 1.6.0
scheduled-query 1.0.0b1

Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1

Additional Context

Related Issues

This seems similar to https://github.com/Azure/azure-cli/issues/29013

yonzhan commented 5 days ago

Thank you for opening this issue, we will look into it.

zoeperryman commented 5 days ago

Ok so I get the same error when running az sql mi update which I guess az resource tag must be a wrapper around.

Command

az sql mi update -g MyGroup -n MyServer --tags MyTag=TagValue

Error

(GPTargetEditionAndUnspecifiedGPV2NotAllowedInUpdateOFGPV2MI) Combination of General Purpose target edition (sku.name/sku.tier parameters) and unspecified value for the isGeneralPurposeV2 parameter is not allowed in the update operation of General Purpose V2 Managed Instance.
Code: GPTargetEditionAndUnspecifiedGPV2NotAllowedInUpdateOFGPV2MI
Message: Combination of General Purpose target edition (sku.name/sku.tier parameters) and unspecified value for the isGeneralPurposeV2 parameter is not allowed in the update operation of General Purpose V2 Managed Instance.

Work around

A work around appears to be to supply the --gpv2 parameter on the update even though it is not being updated and should be optional.

az sql mi update -g MyGroup -n MyServer --tags MyTag=TagValue --gpv2 true