[az resource tag] command change casing for ApplicationInsights name
See original GitHub issueRelated command
az resource tag
Describe the bug
Calling az resource tag --ids “.../microsoft.insights/components/appinsightname”
with a different casing than the AppInsights component currently have will change the casing to the called one.
To Reproduce
Having an Application Insights resource with
- id: “/subscriptions/…/resourcegroups/ResourceGroup/providers/microsoft.insights/components/AppInsightName”
- properties.name: “AppInsightName”
- properties.applicationId: “AppInsightName”
- tags: {}
and calling
az resource tag --ids “/subscriptions/…/resourcegroups/resourcegroup/providers/microsoft.insights/components/appinsightname” --tags tagName=tagValue
(note the lower casing)
will cause the following change
- id: “/subscriptions/…/resourcegroups/ResourceGroup/providers/microsoft.insights/components/AppInsightName”
- properties.name: “appInsightname”
- properties.applicationId: “appInsightname”
- tags: {“tagName”:”tagValue”}
The change of the tags is OK, but there is one unexpected change and that is the change in casing of the application insights component properties name and applicationId. It is not described in the documentation and IMHO a bug.
Expected behavior
There are basically 2 options how to handle it IMHO:
- not changing the properties.name+applicationId
- or throwing “not found” (exception/http404) as the resourceId casing differs.
Environment summary
azure-cli 2.37.0 *
core 2.37.0 *
telemetry 1.0.6 *
Extensions:
account 0.2.3
azure-devops 0.25.0
costmanagement 0.2.1
dataprotection 0.3.0
log-analytics 0.2.2
managementpartner 0.1.3
portal 0.1.2
resource-graph 2.1.0
scheduled-query 0.5.0
storage-preview 0.8.3
Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\JVilimek\.azure\cliextensions'
Python (Windows) 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 22:57:10) [MSC v.1929 32 bit (Intel)]
How to find affected resoures
By running following query in Azure Resource Explorer we were able to identify resources that we affected by the change. 100% of them were Application Insights components:
resources
//| where type in~ ('microsoft.insights/components')
| parse id with '/subscriptions/' subscriptionIdParsed '/resourceGroups/' RGParsed '/providers/' providerType '/' providerName '/' nameParsed
| where isnotempty(nameParsed)
| extend propertiesName = properties.Name
| where isnotempty(propertiesName)
| where propertiesName != nameParsed
| project id, propertiesName, nameParsed, subscriptionIdParsed, providerType, providerName
| summarize count() by providerType, providerName
AppInsights queries affected
Example of AppInsights query, that was affected by the change:
requests
| where timestamp >= datetime('2022/08/23')
| where timestamp <= datetime('2022/08/25')
| summarize count() by appName, bin(timestamp, 1m)
| render timechart
Issue Analytics
- State:
- Created a year ago
- Comments:11 (4 by maintainers)
Top GitHub Comments
route to CXP team
@jennyhunter-msft sorry for not reaching you earlier. The main issue here is, that an
az cli
command that should change just the tag is changing also other properties. As you can see in the screenshot from AppInsights query this change affects data (theappName
):(for query see the original description of the bug)