【Azure APIM】调用APIM的备份接口时候遇见InvalidParameters错误

本文涉及的产品
Serverless 应用引擎 SAE,800核*时 1600GiB*时
应用实时监控服务ARMS - 应用监控,每月50GB免费额度
函数计算FC,每月15万CU 3个月
简介: "Invalid parameter: This request is not authorized to perform this operation.\r\nParameter name: backupContainerName (value: [backupcontainer])"

问题描述

根据官方文档,可以调用REST API来对APIM执行备份操作。

要备份 API 管理服务,请发出以下 HTTP 请求:

POST https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/backup?api-version={api-version}

其中:

  • subscriptionId - 订阅的 ID,该订阅包含的 API 管理服务是你尝试备份的
  • resourceGroupName - Azure API 管理服务的资源组名称
  • serviceName - 正在创建其备份的 API 管理服务的名称,在创建时指定
  • api-version - 有效的 REST API 版本,例如 2021-08-012021-04-01-preview

在请求正文中,指定目标存储帐户名称、Blob 容器名称、备份名称和存储访问类型。 如果存储容器不存在,备份操作将创建存储容器。

{

"storageAccount": "{storage account name for the backup}",

"containerName": "{backup container name}",

"backupName": "{backup blob name}",

"accessKey": "{access key for the account}"

}

但是,总是遇见了如下错误:

{

 "error": {

   "code": "InvalidParameters",

   "message": "Invalid parameter: This request is not authorized to perform this operation.\r\nParameter name: backupContainerName (value: [backupcontainer])",

   "details": null,

   "innerError": null

 }

}

 

问题解答

出现错误 “This request is not authorized to perform this operation.\r\nParameter name: backupContainerName”, 说明APIM资源没有权限对Storage Account Container进行读取操作。

需要检查以下几点:

1) 因为请求使用的Access Key方式访问,所以需要检查 Storage Account 是否启用了防火墙,是否允许公网访问?

2) 如果启用了防火墙,则需要根据文档,开启 APIM 的Resource Instance访问,并且选择指定的APIM Managed Identity。

3) 检查APIM Managed Identity是否有写入Blob的权限,比如需要配置:Storage Blob Data Contributor

4) 在APIM的备份请求体中,需要用 "accessType": "SystemAssignedManagedIdentity" 替换 "accessKey": "{access key for the account}"

 

只要以上都检查后,就能解决not authorized to perform this operation的错误。

 

参考资料

如何使用 Azure API 管理中的服务备份和还原实现灾难恢复 : https://docs.azure.cn/zh-cn/api-management/api-management-howto-disaster-recovery-backup-restore?tabs=rest

 


当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

相关文章
|
28天前
【APIM】启用APIM Analytics时遇见Request failed错误
Data collection is required for detailed monitoring, custom dashboards, and more. A Log Analytics workspace is also required for the data storage. You can change the workspace destination at any time in Diagnostic settings. How do I use Log Analytics?
46 12
|
5月前
|
弹性计算 缓存 Serverless
Serverless 应用引擎操作报错合集之阿里函数计算中我打开sd时遇到错误,信息为"Function instance exited unexpectedly(code 1, message:operation not permitted) with start command ' '."如何解决
Serverless 应用引擎(SAE)是阿里云提供的Serverless PaaS平台,支持Spring Cloud、Dubbo、HSF等主流微服务框架,简化应用的部署、运维和弹性伸缩。在使用SAE过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
269 6
|
2月前
|
存储 API 网络安全
【Azure APIM】调用APIM的备份接口时候遇见InvalidParameters错误
【Azure APIM】调用APIM的备份接口时候遇见InvalidParameters错误
|
2月前
|
API
【Azure APIM】调用APIM的备份接口时候遇见Authentication Failed错误
【Azure APIM】调用APIM的备份接口时候遇见Authentication Failed错误
|
2月前
|
缓存
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
【Azure Function】Function App代码中使用Managed Identity认证获取Blob数据时遇见400报错
|
2月前
|
存储 网络安全 数据中心
【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)
【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)
【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this operation.)
|
2月前
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
53 4
|
2月前
|
XML 缓存 API
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
|
2月前
|
JSON API 网络架构
【Azure APIM】验证APIM删除后的恢复步骤
【Azure APIM】验证APIM删除后的恢复步骤
|
2月前
|
API
【Azure API 管理】解决API Management添加AAD Group时遇见的 Failed to query Azure Active Directory graph due to error 错误
【Azure API 管理】解决API Management添加AAD Group时遇见的 Failed to query Azure Active Directory graph due to error 错误