Closed pmantz closed 4 years ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure.
apparently the issue is with the resourceid values, for some reason even using them simply like this fails
Update-AzTag -ResourceId "/subscriptions/.../resourceGroups/Azure-Splunk-Monitor-AppStg/providers/microsoft.insights/alertrules/xms2_origDTUAlertOver80Percent" -Tag $tags -Operation Merge
Update-AzTag: {"code":"TargetResourceNotFound","message":"The target resource id '/subscriptions/.../resourceGroups/xm-staging1-westus-uemy/providers/Microsoft.Sql/servers/xmsdb-xm-staging1-westus-uemy/datab
ases/xms2_orig' was not found."}
at the same time Get-AzResource works just fine
Get-AzResource -ResourceId /subscriptions/.../resourceGroups/Azure-Splunk-Monitor-AppStg/providers/microsoft.insights/alertrules/xms2_origDTUAlertOver80Percent
Name : xms2_origDTUAlertOver80Percent
ResourceGroupName : Azure-Splunk-Monitor-AppStg
ResourceType : Microsoft.Insights/alertRules
Location : westus
ResourceId : /subscriptions/.../resourceGroups/Azure-Splunk-Monitor-AppStg/prov
iders/microsoft.insights/alertrules/xms2_origDTUAlertOver80Percent
Tags :
Name
Value
===================================================================================================
===================================================================================== ========
hidden-link:/subscriptions/.../resourceGroups/xm-staging1-westus-u
emy/providers/Microsoft.Sql/servers/xmsdb-xm-staging1-westus-uemy/databases/xms2_orig Resource
it seems the alert rules in question were associated with deleted resources that prevented tagging of the alert rules themselves.
Description
Trying to update tags on a resources array generated using a where-object filter, to pick only non tagged resources. Update-AzTag fails due to a null ResourceId, however if I filter resources based on name the command works fine. I've noticed that a lot of times the ResourceId is just trimmed, missing the last give or take 10 chars.
Steps to reproduce
Environment data
Module versions
Debug output
Error output