gpt4 book ai didi

powershell - 为什么我在尝试删除 Microsoft.Insights/components 资源时收到错误?

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

我正在尝试执行一个 PowerShell 脚本,该脚本将使用 .ps1 文件按顺序从资源组中删除 Azure 资源,并且隔离了每当我尝试使用以下命令删除 Microsoft.Insights/components 资源时遇到的错误:命令:

Remove-AzureRmResource -ResourceId "/subscriptions/e41d3122-bbd8-48dc-a212-0337139671cc/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/e41d3122-bbd8-48dc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Remove-AzureRmResource], ErrorResponseMessageException + FullyQualifiedErrorId : Conflict,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet

据我所知,在删除它之前似乎需要满足某种“先决条件”...但最奇怪的部分是,如果我再次执行相同的命令,我不会没有出现错误,资源已成功删除...

有什么原因会导致一次失败,但再次执行后又成功删除了?

最佳答案

这是因为您的 Web 应用程序使用了 Insights。请引用这个link 。当您启用客户端监控时,您将获得错误日志。我在实验室测试过,得到与你相同的结果。

enter image description here

enter image description here

如果你想避免这个错误日志。请引用以下步骤:

1.删除APPINSIGHTS_JAVASCRIPT_ENABLED键。

2.重新启动您的应用程序。

3.删除见解。

关于powershell - 为什么我在尝试删除 Microsoft.Insights/components 资源时收到错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45175980/

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