我之前使用 Terraform 创建并随后删除了 Azure API 管理服务。它消失在Azure Portal中。几个小时后,当我尝试使用相同名称重新创建 API 管理时,我在 Azure 门户中收到此错误:
“名称已被使用。请选择其他名称。”
在 Terraform 中也遇到类似的错误。
有人知道为什么即使我在资源组中不再看到该名称,也无法重复使用该名称吗?
最佳答案
检查您的 APIM service have been soft deleted or not 是否。如果该资源已被软删除,而您想创建一个同名的新资源,则需要清除该资源,然后重新创建。
按名称获取软删除实例:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}?api-version=2020-06-01-preview
列出给定订阅的所有软删除实例:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices?api-version=2020-06-01-preview
恢复已删除的 APIM 实例:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.ApiManagement/service/{apimServiceName}?api-version=2020-06-01-preview
清除软删除的 APIM 实例:
DELETE https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}?api-version=2020-06-01-preview
关于azure - 使用已删除的名称创建 Azure API 管理会导致名称 "already in use"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65349024/