Skip to content

Backup-AzApiManagement: BadRequest #23411

Open
@pim-simons

Description

@pim-simons

Description

We have been using Backup-AzApiManagement for quite a long time to backup our API Management instance, since this week this script has started failing with this error:

Operation returned an invalid status code 'BadRequest'

When I add debug logging I find the following information:

{
  "error": {
    "code": "InvalidParameters",
    "message": "Invalid parameter: Requested value 'GET,HEAD,POST,PUT,DELETE,OPTIONS,PATCH' was not found.\r\nParameter name: backupStorageAccount",
    "details": null,
    "innerError": null
  }
}

Nothing on our side has changed as far as I know, what could be causing this issue?

Issue script & Debug output

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://management.azure.com/subscriptions/{subscription}/resourceGroups/{resourcegroup}/providers/Microsoft.ApiManagement/service/{apimname}/backup?api-version=2021-08-01

Headers:
Accept-Language               : en-US
x-ms-client-request-id        : a050d5b5-6b96-4478-a023-8cb52be674be

Body:
{
  "storageAccount": "{storageaccount}",
  "containerName": "{containername}",
  "backupName": "{backupname}",
  "accessType": "AccessKey",
  "accessKey": "{token}"
}


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

Status Code:
BadRequest

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Server                        : Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-request-id               : 9cde0310-e539-455a-b5cd-b8e7bcf85a91
x-ms-correlation-request-id   : 9cde0310-e539-455a-b5cd-b8e7bcf85a91
x-ms-routing-request-id       : WESTEUROPE:20231114T125043Z:9cde0310-e539-455a-b5cd-b8e7bcf85a91
X-Content-Type-Options        : nosniff
Date                          : Tue, 14 Nov 2023 12:50:42 GMT

Body:
{
  "error": {
    "code": "InvalidParameters",
    "message": "Invalid parameter: Requested value 'GET,HEAD,POST,PUT,DELETE,OPTIONS,PATCH' was not found.\r\nParameter name: backupStorageAccount",
    "details": null,
    "innerError": null
  }
}

Environment data

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

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.13.2                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzConte…
Script     4.0.2                 Az.ApiManagement                    {Add-AzApiManagementApiToGateway, Add-AzApiManage…
Script     6.0.0                 Az.Storage                          {Add-AzRmStorageContainerLegalHold, Add-AzStorage

Error output

HistoryId: 2

Message        : Operation returned an invalid status code 'BadRequest'
StackTrace     :    at Microsoft.Azure.Management.ApiManagement.ApiManagementServiceOperations.BeginBackupWithHttpMessa
                 gesAsync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters
                 parameters, Dictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Azure.Management.ApiManagement.ApiManagementServiceOperations.BackupWithHttpMessagesAs
                 ync(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters
                 parameters, Dictionary`2 customHeaders, CancellationToken cancellationToken)
                    at Microsoft.Azure.Management.ApiManagement.ApiManagementServiceOperationsExtensions.BackupAsync(IA
                 piManagementServiceOperations operations, String resourceGroupName, String serviceName,
                 ApiManagementServiceBackupRestoreParameters parameters, CancellationToken cancellationToken)
                    at Microsoft.Azure.Management.ApiManagement.ApiManagementServiceOperationsExtensions.Backup(IApiMan
                 agementServiceOperations operations, String resourceGroupName, String serviceName,
                 ApiManagementServiceBackupRestoreParameters parameters)
                    at Microsoft.Azure.Commands.ApiManagement.ApiManagementClient.BackupApiManagement(String
                 resourceGroupName, String serviceName, String storageAccountName, String storageAccountKey, String
                 backupContainer, String backupBlob, String accessType, String identityClientId)
                    at Microsoft.Azure.Commands.ApiManagement.Commands.BackupAzureApiManagement.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
                 OrAsJob>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()
Exception      : Microsoft.Azure.Management.ApiManagement.Models.ErrorResponseException
InvocationInfo : {Backup-AzApiManagement}
Line           : Backup-AzApiManagement -ResourceGroupName "{resourcegroup}" -Name "{apimname}" -StorageContext
                 $StorageContext -TargetContainerName "{containername}" -TargetBlobName "{backupname}" -verbose -debug
Position       : At C:\Users\Pim Simons\Desktop\test.ps1:4 char:1
                 + Backup-AzApiManagement -ResourceGroupName "vg-acc-esb-infra" -Name "v …
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    API ManagementService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions