如何清除软删除的文本分析?

How to purge soft-deleted Text analytics?

为了测试 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.

我不得不就此联系 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 resource delete /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

这里是link到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'

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

az resource delete --ids $id

只有这个对我有用:

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