考虑以下代码。它创建一个应用程序洞察,然后它检索检测密钥并将其分配给我的 web 应用程序。
az monitor app-insights component create -g $resourceGroup --app $webapp --application-type web --kind web --tags $defaultTags
$instrumentationKey = az monitor app-insights component show -g $resourceGroup -a $webapp --query 'instrumentationKey' -o tsv
az webapp config appsettings set -g $resourceGroup -n $webapp --settings APPINSIGHTS_INSTRUMENTATIONKEY=$instrumentationKey APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=$instrumentationKey
Run Code Online (Sandbox Code Playgroud)
但是,这不会打开此屏幕截图中所示的 web 应用程序的应用程序洞察力。我不知道如何从 azure cli 打开它。