如何通过Azure CLI导出Application Insights名称与Instrumentation Key列表
解决方法:获取订阅内Application Insights的名称与检测密钥
az resource list默认不会返回Application Insights组件的完整属性集合,包括检测密钥(Instrumentation Key),因此需要使用Azure CLI中专门针对Application Insights的命令来获取:
基础查询(表格格式输出)
az monitor app-insights component list --query "[].{Name:name, InstrumentationKey:instrumentationKey}" --output table
导出为CSV文件
如果需要将结果导出到CSV文件方便后续处理,可替换输出格式参数:
az monitor app-insights component list --query "[].{Name:name, InstrumentationKey:instrumentationKey}" --output csv > ai-instrumentation-keys.csv
说明
az monitor app-insights component list是Azure CLI提供的专门枚举Application Insights组件的命令,会返回包含检测密钥在内的完整资源属性--query参数用于筛选并格式化输出字段,将原始字段name和instrumentationKey重命名为更易读的列名--output参数控制输出格式,table适合直接查看,csv适合导出到文件
内容的提问来源于stack exchange,提问作者s.demuro
相关产品推荐
相关产品推荐

