azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

New-AzTag : Operation returned an invalid status code 'Accepted' on SQL database

Open pmarguerite-kayentis opened this issue 2 years ago • 12 comments

Description

I have a script creating and updating tags on it and and for the last few days , the New-AzTag command failed on a Ms Sql database resource with the message New-AzTag: Operation returned an invalid status code 'Accepted' The tags are however correctly created.

I works fine on the other resource, i am updating and it was previously working there was no change on the script, nor update of Powershell or the AZ module version

Issue script & Debug output

$DebugPreference='Continue'
PS >     Update-AzTag -ResourceId $resource.id -Tag $Tags  -Verbose -Operation Replace  -DEBUG
DEBUG: 1:21:45 PM - UpdateAzureTagCommand begin processing with ParameterSet 'UpdateByResourceIdParameterSet'.
DEBUG: 1:21:45 PM - using account id ''...

Confirm
Are you sure you want to perform this action?
Performing the operation "Updating the entire set of tags with 'Replace' operation" on target
"/subscriptions/XXX/resourceGroups/rg-sql-sd/providers/Microsoft.Sql/servers/sql-kay-s
d/databases/YYYY".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
DEBUG: [Common.Authentication]: Authenticating using Account: '', environment: 'AzureCloud', tenant: 'ZZZZZZ'
DEBUG: 1:21:47 PM - [ManagedServiceIdentityAuthenticator] Calling ManagedIdentityCredential.GetTokenAsync - TenantId:'ZZZZZZ', Scopes:'https://management.core.windows.net/', UserId:''
DEBUG: ManagedIdentityCredential.GetToken invoked. Scopes: [ https://management.core.windows.net/ ] ParentRequestId:
DEBUG: Probing IMDS endpoint for availability. Endpoint: http://169.254.169.254/metadata/identity/oauth2/token
DEBUG: IMDS endpoint is available. Endpoint: http://169.254.169.254/metadata/identity/oauth2/token
DEBUG: Request [-----------] GET http://169.254.169.254/metadata/identity/oauth2/token?api-version=REDACTED&resource=REDACTED
Metadata:REDACTED
x-ms-client-request-id:4160867d-ce2b-4ae5-9d17-ad8c4587f1c2
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Identity/1.4.0,(.NET 6.0.6; Microsoft Windows 10.0.19043)
client assembly: Azure.Identity
DEBUG: Response [-------] 200 OK (00.1s)
Server:IMDS/150.870.65.684
Date:Tue, 02 Aug 2022 11:21:47 GMT
Content-Type:application/json; charset=utf-8
Content-Length:2004

DEBUG: ManagedIdentityCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net/ ] ParentRequestId:  ExpiresOn: 2022-08-03T10:38:58.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '-------', UserId: '-------'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PATCH

Absolute Uri:
https://management.azure.com//subscriptions/-------/resourceGroups/-------/providers/Microsoft.Sql/servers/-------/databases/-------/providers/Microsoft.Resources/tags/default?api-version=2020-10-01

Headers:
x-ms-client-request-id        : -------
Accept-Language               : en-US

Body:
{
  "operation": "Replace",
  "properties": {
    "tags": {
      "product": "cf3",
      "deploymentDate": "2022-08-02T04.52.45.1059461-02.00",
      "department": "se",
      "study": "nightlyclinforce",
      "sponsor": "kay",
      "criticality": "low",
      "created_by": "Timer Trigger",
      "owner": "Timer Trigger",
      "deployment_time": "20220802-045241",
      "tier": "database",
      "env": "sbsd"
    }
  }
}


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
Accepted

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Location                      : https://management.azure.com/subscriptions/-------/resourceGroups/-------/providers/Microsoft.Sql/locations/francecentral/databaseOperationResults/-------?api-version=2022-02-01-preview
x-ms-ratelimit-remaining-subscription-writes: 1197
x-ms-request-id               : cb4ab6f3-a4e6-4d16-9674-989dcb1890fd
x-ms-correlation-request-id   : cb4ab6f3-a4e6-4d16-9674-989dcb1890fd
x-ms-routing-request-id       : FRANCECENTRAL:20220802T112148Z:cb4ab6f3-a4e6-4d16-9674-989dcb1890fd
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Date                          : Tue, 02 Aug 2022 11:21:47 GMT

Body:



Update-AzTag: Operation returned an invalid status code 'Accepted'
DEBUG: AzureQoSEvent: CommandName - Update-AzTag; IsSuccess - False; Duration - 00:00:02.5713926; Exception - Operation returned an invalid status code 'Accepted';
DEBUG: Finish sending metric.
DEBUG: 1:21:48 PM - UpdateAzureTagCommand end processing.

Environment data

PS > $PSVersionTable

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

Module versions

PS > Get-Module Az*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.4.0                 Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefa…
Script     4.2.0                 Az.Resources                        {Add-AzADGroupMember, Export-AzResourceGroup, Exp…

Error output

PS > Resolve-AzError -Last
DEBUG: 1:26:15 PM - ResolveError begin processing with ParameterSet 'LastErrorParameterSet'.
DEBUG: 1:26:15 PM - using account id 'REDACTED'...
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.

   HistoryId: 36

RequestId      :REDACTED
Message        : Operation returned an invalid status code 'Accepted'
ServerMessage  :
ServerResponse : {Accepted}
RequestMessage : {PUT https://management.azure.com//subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Sql/servers/REDACTED/datab
                 ases/REDACTED/providers/Microsoft.Resources/tags/default?api-version=2020-10-01}
InvocationInfo : {New-AzTag}
Line           :     New-AzTag -ResourceId $resource.id -Tag $Tags  -Verbose | Out-Null
Position       : At line:1 char:5
                 +     New-AzTag -ResourceId $resource.id -Tag $Tags  -Verbose | Out-Nul …
                 +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace     :    at Microsoft.Azure.Management.ResourceManager.TagsOperations.CreateOrUpdateAtScopeWithHttpMessagesAsync(String scope, TagsResource parameters, Dictionary`2
                 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Azure.Management.ResourceManager.TagsOperationsExtensions.CreateOrUpdateAtScopeAsync(ITagsOperations operations, String scope, TagsResource
                 parameters, CancellationToken cancellationToken)
                    at Microsoft.Azure.Management.ResourceManager.TagsOperationsExtensions.CreateOrUpdateAtScope(ITagsOperations operations, String scope, TagsResource
                 parameters)
                    at Microsoft.Azure.Commands.Tags.Client.TagsClient.CreateOrUpdateTagAtScope(String scope, IDictionary`2 parameters)
                    at Microsoft.Azure.Commands.Tags.Tag.NewAzureTagCommand.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()
HistoryId      : 36


The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.0264169
DEBUG: Finish sending metric.
DEBUG: 1:26:15 PM - ResolveError end processing.

pmarguerite-kayentis avatar Aug 02 '22 11:08 pmarguerite-kayentis

Thank you for your feedback. This has been routed to the support team for assistance.

msftbot[bot] avatar Aug 03 '22 02:08 msftbot[bot]

I'm running into the same issue with Azure CLI az tag create.

The REST api seems to have changed.

RobHofmann avatar Aug 03 '22 08:08 RobHofmann

Ran into the same issue as well.

JurrianAK avatar Aug 03 '22 09:08 JurrianAK

I ran into same issue also. Previously it worked fine but now this Accepted issue is appearing.

Denjaa avatar Aug 03 '22 09:08 Denjaa

Also experiencing this with Update-AzTag in pwsh Az.Resources v 6.0.1

silverl avatar Aug 03 '22 13:08 silverl

@pmarguerite-kayentis We are looking into it and get back to you for any additional information.

SaurabhSharma-MSFT avatar Aug 03 '22 17:08 SaurabhSharma-MSFT

@pmarguerite-kayentis I am seeing the same behavior and looking into this. image

SaurabhSharma-MSFT avatar Aug 04 '22 00:08 SaurabhSharma-MSFT

Same here for using Update-AzTag with the 'Reolace' operation.

JoVuon avatar Aug 04 '22 06:08 JoVuon

It should be ARM regression issue. Service team is fixing it.

dingmeng-xue avatar Aug 04 '22 11:08 dingmeng-xue

customers are also experiencing this issue using Tags - Update At Scope:

Azure SDk to remove tags using UpdateAtScope API on disk. The tags on the disk were removed successfully but it raises an exception=Microsoft.Rest.Azure.CloudException: Operation returned an invalid status code 'Accepted'.

ARM is showing 202

smorasoto avatar Aug 05 '22 18:08 smorasoto

Same here with PWSH/Update-AZTag. We have to work around this issue by using PWSH -ErrorAction SilentlyContinue, which is risky as normal problems will now not popup anymore. AZ.Resources is 6.1.0

MrFly72 avatar Aug 08 '22 16:08 MrFly72

The issue will be fixed on service side within one week.

dingmeng-xue avatar Aug 09 '22 06:08 dingmeng-xue

Thanks for the update, facing the same issue at the moment.

wimmatthyssen avatar Aug 10 '22 12:08 wimmatthyssen

Anydate on this ?

DevanshuSyk avatar Aug 12 '22 03:08 DevanshuSyk

Any update on this issue?

LloydVillegas avatar Aug 15 '22 15:08 LloydVillegas

I switched over to rest-API which increased speed of my function app significantly as loading the AZ.Resources is now not needed anymore.

MrFly72 avatar Aug 15 '22 15:08 MrFly72

@pmarguerite-kayentis sorry for the delay on this. Product team is already working on a fix for this. Meanwhile you can use az rest command to request REST api directly as a work around Or you can try to update the tag with the update command of RP resource (such as az group update --tags) or az resource update --set tags.key=value

SaurabhSharma-MSFT avatar Aug 15 '22 18:08 SaurabhSharma-MSFT

@pmarguerite-kayentis sorry for the delay on this. Product team is already working on a fix for this. Meanwhile you can use az rest command to request REST api directly as a work around Or you can try to update the tag with the update command of RP resource (such as az group update --tags) or az resource update --set tags.key=value

Hi there @SaurabhSharma-MSFT . Can you confirm this has this been fixed?

srjennings avatar Sep 01 '22 12:09 srjennings

@srjennings I see this has been fixed and I tried running new-aztag/update-aztag without any issues.

@pmarguerite-kayentis Please let me know if you have any concerns, else we will proceed with the closure of this issue. Thanks.

SaurabhSharma-MSFT avatar Sep 06 '22 18:09 SaurabhSharma-MSFT

@pmarguerite-kayentis We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

SaurabhSharma-MSFT avatar Sep 12 '22 22:09 SaurabhSharma-MSFT