【问题标题】:How to purge soft-deleted Text analytics?如何清除软删除的文本分析?
【发布时间】:2021-08-09 17:30:48
【问题描述】:

为了测试 ARM 模板,我们首先将它们部署在测试资源组中。在晚上 7 点,这些资源组将被自动删除。昨天它工作正常,今天我无法再部署到相同的测试资源组名称。好久没换模板了。

我在 Azure 门户的任何地方都找不到这个软删除的服务,也不知道如何清除它。

14:43:17 - Error: Code=FlagMustBeSetForRestore; Message=An existing resource with ID
     | '/subscriptions/GUID/resourceGroups/myRG/providers/Microsoft.CognitiveServices/accounts/my-ta-zneztme4oqjb2' has been
     | soft-deleted. To restore the resource, you must specify 'restore' to be 'true' in the property. If you don't want to restore existing resource, please purge it first.

【问题讨论】:

  • 我也无法删除 Azure 表单识别器资源。我遇到了同样的错误。这个你搞定了吗?
  • 不,我昨天尝试的时候刚刚成功。我能够再次部署它。
  • 花了一天时间吗? 1天后我才试了,还是不行
  • 不止于此。我星期四问了问题,它可能在星期二开始工作。我可能周一没有检查。当我在 Twitter 上询问 Azure 支持时,他们给了我这个链接:docs.microsoft.com/en-us/rest/api/apimanagement/…。它用于错误的服务,但文本分析可能也存在这样的端点。

标签: azure azure-resource-manager azure-cognitive-services


【解决方案1】:

这里是rest endpoints you can call against cognitive services的链接

有一个端点可以列出已删除的认知服务,您可以像这样调用它:

az rest --method get --header 'Accept=application/json' -u 'https://management.azure.com/subscriptions/$SubscriptionId/providers/Microsoft.CognitiveServices/deletedAccounts?api-version=2021-04-30'

它返回已删除认知服务的 json 结构列表。 每个被删除的服务都有一个 id 属性,这是你传递给 delete 方法的东西:

az resource delete --ids $id

【讨论】:

  • 第一步还有一个az cli命令:az cognitiveservices account list-deleted
【解决方案2】:

我不得不就此联系 Microsoft 支持。它仍然不是 100% 为我工作,但也许它可能适用于其他人。

要从撤消保留区域中清除最近删除的资源(并为新资源释放名称),请使用以下方法之一:

RestAPI

删除https://management.azure.com/subscriptions/{subscirptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroup}/deletedAccounts/{accountName}?Api-Version=2021-04-30

CLI

az 资源删除 /subscriptions/{subscirptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroup}/deletedAccounts/{accountName}

Powershell

Remove-AzResource -ResourceId /subscriptions/{subscirptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroup}/deletedAccounts/{accountName} -ApiVersion 2021-04-30

【讨论】:

  • 这就是我使用 Az PowerShell 删除它的方式:Invoke-AzRestMethod -Path "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{rgName}/deletedAccounts/{accountName}?api-version=2021-04-30" -Method "DELETE"
  • az 资源删除需要一个 --ids 参数并且没有从保留区域中删除 az resource delete --ids /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resource-group/providers/microsoft.cognitiveservices/accounts/resource-account
【解决方案3】:

只有这对我有用:

az cognitiveservices account purge -l northeurope -n your-service-name -g your-rg

【讨论】:

    猜你喜欢
    • 2015-09-29
    • 2019-12-04
    • 1970-01-01
    • 2015-02-21
    • 1970-01-01
    • 2016-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多