gpt4 book ai didi

azure - 显示链接到 Azure 上应用洞察资源的所有资源

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

我想查看使用特定 App Insights 的所有资源(功能应用等)。这是因为我想删除应用程序见解并重新创建它。到目前为止我不知道如何实现这一目标。我找不到在门户上或通过 Azure CLI 执行此操作的方法。

通过 Azure CLI 我得到的最接近的是:

az graph query -q "Resources | where isnotnull(properties['ConnectionString']) | where '<CONNECTIONSTRING>' contains properties['ConnectionString'] | project properties['ConnectionString'], name"

但我发现大多数资源都有一个空的 ConnectionStrings,这似乎无法通过图形查询来工作。有什么建议吗?

我遇到了https://learn.microsoft.com/en-us/answers/questions/742697/i-want-to-query-the-application-settings-on-a-func 。这真的是唯一的可变选项吗?

谢谢

最佳答案

Show all the resources linked to a app insights resource on Azure: -

在解决您的要求后,我找到了一种使用 PowerShell 的方法,脚本如下。

$app=Get-AzWebApp -ResourceGroupName "<resourcegroup>" -Name "KeyVaultPublish2023"
$setting_name=$app.SiteConfig.AppSettings.Name
$setting_value=$app.SiteConfig.AppSettings.value
if($setting_name -contains "APPINSIGHTS_INSTRUMENTATIONKEY"){
write-output "App insights exists"
if($setting_value -contains "<Give the required app insight to check>") #for eg: xxxxxx0-442f-8c0dr-2xxxx
{
write-output "App insight key is using the app insight resource."
}else{
write-output "Not matched."
}
}

enter image description here

注意:您可以使用 APPLICATIONINSIGHTS_CONNECTION_STRINGAPPINSIGHTS_INSTRUMENTATIONKEY 检查它是否链接到特定的应用洞察资源。我已经检查了资源组下的一项应用程序服务。要检查所有资源,请使用foreach ($app in $apps) 在上面的代码中使其工作。

关于azure - 显示链接到 Azure 上应用洞察资源的所有资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/77112130/

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