question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[az resource tag] command change casing for ApplicationInsights name

See original GitHub issue

Related 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

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yonzhancommented, Sep 15, 2022

route to CXP team

0reactions
jvilimekcommented, Nov 4, 2022

@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 (the appName):

image

(for query see the original description of the bug)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use tags to organize your Azure resources and management ...
The az tag create replaces all tags on the resource, resource group, or subscription. When you call the command, pass the resource ID...
Read more >
Create Update and Delete Tags on Azure Resource
To remove all tags from your Azure subscription, use the Remove-AzTag command. # Get subscription by it's name $subscription = (Get- ...
Read more >
Given an Applications Insight Instrumentation key, get the ...
Using azure cloud shell (or any shell where you have azure-cli ^2.0.64 installed): az extension add --name application-insights az monitor app-insights ...
Read more >
Infrastructure as Code - An intro - Part 2 - Using Azure CLI
az group show --help Command az group show : Gets a resource group. ... you can replace the --location parameter with -l ,...
Read more >
AWS::SSM::Association - AWS CloudFormation
The names or Amazon Resource Names (ARNs) of the Change Calendar type documents ... in this case commands to install nginx Parameters: commands:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found