Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.22k stars 3.82k forks source link

Update-AzTag on privateDNS uses unavailable API version #23668

Open lansalot opened 9 months ago

lansalot commented 9 months ago

Description

PS> $res
Name              : privatelink.eventgrid.azure.net
ResourceGroupName : rg-swa-hub-networking-001
ResourceType      : Microsoft.Network/privateDnsZones

PS> Update-aztag -ResourceId $res.resourceid -tag $tags -operation replace -debug -verbose
(snip)
Body:
{
  "error": {
    "code": "InvalidResourceType",
    "message": "The resource type 'privateDnsOperationResults' could not be found in the namespace 'Microsoft.Network' for api version '2022-09-01'. The supported api-versions are '2018-09-01,2020-01-01,2020-06-01'."
  }
}

DEBUG: 13:01:15 - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 13:01:15 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Update-AzTag: Long running operation failed with status 'NotFound'.

As you can see, api version is incorrect if trying to update tags.

Issue script & Debug output

Date                          : Tue, 05 Dec 2023 13:23:59 GMT

Body:
{
  "error": {
    "code": "InvalidResourceType",
    "message": "The resource type 'privateDnsOperationResults' could not be found in the namespace 'Microsoft.Network' for api version '2022-09-01'. The supported api-versions are '2018-09-01,2020-01-01,2020-06-01'."
  }
}

DEBUG: 13:24:06 - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 13:24:06 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Update-AzTag: Long running operation failed with status 'NotFound'.
DEBUG: 13:24:06 - [ConfigManager] Got [False] from [DisplayBreakingChangeWarning], Module = [], Cmdlet = [].
DEBUG: 13:24:06 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 13:24:06 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: az.resources:6.12.1; CommandName: Update-AzTag; PSVersion: 7.3.9; IsSuccess: False; Duration: 00:00:32.7845471; Exception: Long running operation failed with status 'NotFound'.;

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.9
PSEdition                      Core
GitCommitId                    7.3.9
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

get-module

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.13.2                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     6.12.1                az.resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty…}
Manifest   7.0.0.0               Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature…}
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object…}
Manifest   7.0.0.0               Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP…}
Script     2.2.6                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler…}

Error output

Message        : Long running operation failed with status 'NotFound'.
ServerMessage  : InvalidResourceType: The resource type 'privateDnsOperationResults' could not be found in the namespace 'Microsoft.Network' for api version '2022-09-01'. The supported api-versions are
                 '2018-09-01,2020-01-01,2020-06-01'. (System.Collections.Generic.List`1[Microsoft.Rest.Azure.CloudError])
ServerResponse : {NotFound}

InvocationInfo : {Update-AzTag}
Line           : update-aztag -ResourceId $res.resourceid -tag $tags -operation replace -debug -verbose
Position       : At line:1 char:1
                 + update-aztag -ResourceId $res.resourceid -tag $tags -operation replac …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Rest.ClientRuntime.Azure.LRO.LROPollState`2.CheckErrorStatusAndThrowAsync(HttpRequestMessage request, HttpResponseMessage response)
                    at Microsoft.Rest.ClientRuntime.Azure.LRO.LROPollState`2.GetRawAsync(Dictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Rest.ClientRuntime.Azure.LRO.LROPollState`2.UpdateResourceFromPollingUri(Dictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Rest.ClientRuntime.Azure.LRO.LROPollState`2.Poll(Dictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Rest.ClientRuntime.Azure.LRO.AzureLRO`2.StartPollingAsync()
                    at Microsoft.Rest.ClientRuntime.Azure.LRO.AzureLRO`2.BeginLROAsync()
                    at Microsoft.Rest.Azure.AzureClientExtensions.GetLongRunningOperationResultAsync[TBody,THeader](IAzureClient client, AzureOperationResponse`2 response, Dictionary`2 customHeaders, CancellationToken
                 cancellationToken)
                    at Microsoft.Rest.Azure.AzureClientExtensions.GetPutOrPatchOperationResultAsync[TBody,THeader](IAzureClient client, AzureOperationResponse`2 response, Dictionary`2 customHeaders, CancellationToken
                 cancellationToken)
                    at Microsoft.Azure.Management.Resources.TagsOperations.UpdateAtScopeWithHttpMessagesAsync(String scope, TagsPatchResource parameters, Dictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Azure.Management.Resources.TagsOperationsExtensions.UpdateAtScopeAsync(ITagsOperations operations, String scope, TagsPatchResource parameters, CancellationToken cancellationToken)
                    at Microsoft.Azure.Management.Resources.TagsOperationsExtensions.UpdateAtScope(ITagsOperations operations, String scope, TagsPatchResource parameters)
                    at Microsoft.Azure.Commands.Tags.Client.TagsClient.UpdateTagAtScope(String scope, TagPatchOperation operation, IDictionary`2 parameters)
                    at Microsoft.Azure.Commands.Tags.Tag.UpdateAzureTagCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
H
microsoft-github-policy-service[bot] commented 9 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @rthorn17.