gpt4 book ai didi

powershell - 无法在 PowerShell 中删除 Microsoft.Insights/组件资源

转载 作者:行者123 更新时间:2023-12-03 03:05:01 25 4
gpt4 key购买 nike

我以前曾问过这个问题一次,但意识到我得到的答案并没有解决整个问题。

在我的 PowerShell 脚本中,我部署了一个 Web 应用程序以及与其一起使用的 Application Insights 资源(包括 Microsoft.Insights/components 资源)。在另一个脚本中,我从资源组中删除这些相同的资源,但保留组名称,因为我不是唯一在该组中工作的人。

当我尝试删除资源时出现问题。无论我选择的顺序如何,当我执行命令时:

Remove-AzureRmResource -ResourceId "/subscriptions/<subscriptionId>/resourceGroups/TestRG/providers/Microsoft.Insights/components/WA-Stag-API-EMEA-zgqmgcwnigknu"

我立即收到错误:

Remove-AzureRmResource : {"code":"Message: {\"Errors\":[\"One of the specified pre-condition is not met\"]}","message":"Message: {\"Errors\":[\"One of the specified pre-condition is not met\"]}\r\nActivityId: 845b19fa-b6b4-4952-9b62-75bfc6e98646, Request URI: /apps/1921ec42-1c88-4fdd-8d6c-78646cba4b15/services/a32b484a-6ee1-4ad7-ab43-4e9 d57bb0b81/partitions/fab8c193-3ec3-45e8-b7a6-0e21d1e071da/replicas/131441657816991616p","innererror":{"diagnosticcontext":"597ea546-7625-474d-b27f-560a1140a652","time":"2017- 07-18T19:41:25.3734216Z"}} At line:1 char:1 + Remove-AzureRmResource -ResourceId "/subscriptions/ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Remove-AzureRmResource], ErrorResponseMessageException + FullyQualifiedErrorId : Conflict,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet

但是,如果我再次尝试相同的命令,资源将被成功删除,并且在 Azure 门户上不再可见。我真的很想知道为什么会发生这种情况以及如何解决正在发生的问题。该错误似乎很长且含糊,所以我现在不知道在哪里寻找补救措施。

编辑这是我用来部署资源的 ARM 模板: https://jsonblob.com/1b4ddaa4-6cef-11e7-a38a-2184080e56f4

最佳答案

当 Web 应用程序或其他资源使用 Insights 时,您将收到错误日志。我检查了您的模板,对于开发环境,我建议您不要使用与您的网络应用程序和 Insights 相同的名称。您最好为您的见解使用动态名称。它可以确保它不被其他网络应用程序使用。

关于powershell - 无法在 PowerShell 中删除 Microsoft.Insights/组件资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45200736/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com