尧图网络 高端网站定制 · 原创设计
免费咨询热线
400-888-6620
免费获取方案
【计算机工具类-监控和日志Skills】azure-mgmt-applicationinsights-dotnet 技能
Azure Application Insights SDK for .NET. Application performance monitoring and observability resource management.技能概述azure-mgmt-applicationinsights-dotnet 技能用于管理Application Insights资源用于应用程序性能监控。此SDK提供完整的Application Insights资源管理功能包括创建、更新、删除和监控应用程序性能。下载地址agentic-awesome-skills/skills/azure-mgmt-applicationinsights-dotnet at main · sickn33/agentic-awesome-skills · GitHub安装dotnet add package Azure.ResourceManager.ApplicationInsights dotnet add package Azure.Identity当前版本v1.0.0 (GA)API版本2022-06-15环境变量AZURE_SUBSCRIPTION_IDyour-subscription-idAZURE_RESOURCE_GROUPyour-resource-groupAZURE_APPINSIGHTS_NAMEyour-appinsights-component身份验证using Azure.Identity;using Azure.ResourceManager;using Azure.ResourceManager.ApplicationInsights;ArmClient client new ArmClient(new DefaultAzureCredential());资源层次结构Subscription└── ResourceGroup└── ApplicationInsightsComponent # App Insights resource├── ApplicationInsightsComponentApiKey # API keys for programmatic access├── ComponentLinkedStorageAccount # Linked storage for data export└── (via component ID)├── WebTest # Availability tests├── Workbook # Workbooks for analysis├── WorkbookTemplate # Workbook templates└── MyWorkbook # Private workbooks核心工作流1. 创建Application Insights组件基于工作区using Azure.ResourceManager.ApplicationInsights;using Azure.ResourceManager.ApplicationInsights.Models;ResourceGroupResource resourceGroup await client.GetDefaultSubscriptionAsync().Result.GetResourceGroupAsync(my-resource-group);ApplicationInsightsComponentCollection components resourceGroup.GetApplicationInsightsComponents();// Workspace-based Application Insights (recommended)ApplicationInsightsComponentData data new ApplicationInsightsComponentData(AzureLocation.EastUS,ApplicationInsightsApplicationType.Web){Kind web,WorkspaceResourceId new ResourceIdentifier(/subscriptions/sub-id/resourceGroups/rg/providers/Microsoft.OperationalInsights/workspaces/workspace-name),IngestionMode IngestionMode.LogAnalytics,PublicNetworkAccessForIngestion PublicNetworkAccessType.Enabled,PublicNetworkAccessForQuery PublicNetworkAccessType.Enabled,RetentionInDays 90,SamplingPercentage 100,DisableIPMasking false,ImmediatePurgeDataOn30Days false,Tags {{ environment, production },{ application, mywebapp }}};ArmOperationApplicationInsightsComponentResource operation await components.CreateOrUpdateAsync(WaitUntil.Completed, my-appinsights, data);ApplicationInsightsComponentResource component operation.Value;Console.WriteLine($Component created: {component.Data.Name});Console.WriteLine($Instrumentation Key: {component.Data.InstrumentationKey});Console.WriteLine($Connection String: {component.Data.ConnectionString});2. 获取连接字符串和密钥ApplicationInsightsComponentResource component await resourceGroup.GetApplicationInsightsComponentAsync(my-appinsights);// Get connection string for SDK configurationstring connectionString component.Data.ConnectionString;string instrumentationKey component.Data.InstrumentationKey;string appId component.Data.AppId;Console.WriteLine($Connection String: {connectionString});Console.WriteLine($Instrumentation Key: {instrumentationKey});Console.WriteLine($App ID: {appId});3. 创建API密钥ApplicationInsightsComponentResource component await resourceGroup.GetApplicationInsightsComponentAsync(my-appinsights);ApplicationInsightsComponentApiKeyCollection apiKeys component.GetApplicationInsightsComponentApiKeys();// API key for reading telemetryApplicationInsightsApiKeyContent keyContent new ApplicationInsightsApiKeyContent{Name ReadTelemetryKey,LinkedReadProperties {$/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{component.Data.Name}/api,$/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{component.Data.Name}/agentconfig}};ApplicationInsightsComponentApiKeyResource apiKey await apiKeys.CreateOrUpdateAsync(WaitUntil.Completed, keyContent);Console.WriteLine($API Key Name: {apiKey.Data.Name});Console.WriteLine($API Key: {apiKey.Data.ApiKey}); // Only shown once!// 4. 创建Web测试可用性测试WebTestCollection webTests resourceGroup.GetWebTests();// URL Ping TestWebTestData urlPingTest new WebTestData(AzureLocation.EastUS){Kind WebTestKind.Ping,SyntheticMonitorId webtest-ping-myapp,WebTestName Homepage Availability,Description Checks if homepage is available,IsEnabled true,Frequency 300, // 5 minutesTimeout 120, // 2 minutesWebTestKind WebTestKind.Ping,IsRetryEnabled true,Locations {new WebTestGeolocation { WebTestLocationId us-ca-sjc-azr }, // West USnew WebTestGeolocation { WebTestLocationId us-tx-sn1-azr }, // South Central USnew WebTestGeolocation { WebTestLocationId us-il-ch1-azr }, // North Central USnew WebTestGeolocation { WebTestLocationId emea-gb-db3-azr }, // UK Southnew WebTestGeolocation { WebTestLocationId apac-sg-sin-azr } // Southeast Asia},Configuration new WebTestConfiguration{WebTest WebTest NameHomepage EnabledTrue Timeout120 xmlnshttp://microsoft.com/schemas/VisualStudio/TeamTest/2010ItemsRequest MethodGET Version1.1 Urlhttps://myapp.example.com ThinkTime0 Timeout120 ParseDependentRequestsFalse FollowRedirectsTrue RecordResultTrue CacheFalse ResponseTimeGoal0 Encodingutf-8 ExpectedHttpStatusCode200 //Items/WebTest},Tags {{ $hidden-link:/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/my-appinsights, Resource }}};ArmOperationWebTestResource operation await webTests.CreateOrUpdateAsync(WaitUntil.Completed, webtest-homepage, urlPingTest);WebTestResource webTest operation.Value;Console.WriteLine($Web test created: {webTest.Data.Name});核心功能功能描述Application Insights组件管理创建、更新、删除和监控Application Insights资源API密钥管理创建和管理用于编程访问的API密钥Web测试创建可用性测试以监控应用程序可用性工作簿创建和管理用于分析的工作簿链接存储配置数据导出的链接存储账户连接字符串管理获取连接字符串和检测密钥最佳实践使用基于工作区的Application Insights- 推荐用于新的部署安全存储API密钥- API密钥只显示一次配置适当的保留期- 根据需求设置数据保留使用标签组织资源- 为资源添加环境、应用程序等标签配置采样百分比- 根据流量设置适当的采样率启用公共网络访问控制- 根据安全需求配置网络访问定期监控Web测试- 检查可用性测试结果使用DefaultAzureCredential- 用于安全的身份验证配置多个测试位置- 从多个地理位置测试可用性文档化资源- 记录Application Insights配置和用途常见使用场景应用程序性能监控- 监控应用程序性能和可用性故障诊断- 识别和诊断应用程序问题用户行为分析- 分析用户行为和使用模式可用性监控- 通过Web测试监控应用程序可用性自定义指标- 跟踪自定义业务指标依赖跟踪- 监控外部依赖项的性能日志分析- 使用Kusto查询分析日志警报配置- 设置性能和可用性警报
RELATED

相关推荐

百度文库下载被付费墙拦住?开源脚本 baidu-wenku 免登录把整篇文档存成PDF

百度文库下载被付费墙拦住?开源脚本 baidu-wenku 免登录把整篇文档存成PDF

百度文库下载被付费墙拦住?开源脚本 baidu-wenku 免登录把整篇文档存成PDF 【免费下载链接】baidu-wenku fetch the document for free 项目地址: https://gitcode.com/gh_mirrors/ba/baidu-wenku 为了一份行业报告,你在百度文库翻完了全部正文&a…

📅 2026/9/29 22:44:04
网盘下载工具怎么选?网盘直链下载助手完整上手教程,从0到1告别限速

网盘下载工具怎么选?网盘直链下载助手完整上手教程,从0到1告别限速

网盘下载工具怎么选?网盘直链下载助手完整上手教程,从0到1告别限速 【免费下载链接】Online-disk-direct-link-download-assistant 一个基于 JavaScript 的网盘文件下载地址获取工具。基于【网盘直链下载助手】修改 ,支持 百度网盘 / 阿里云盘…

📅 2026/10/5 15:45:35
5分钟上手bilibili-downloader:B站视频下载工具,大会员4K与充电视频一次拿下

5分钟上手bilibili-downloader:B站视频下载工具,大会员4K与充电视频一次拿下

5分钟上手bilibili-downloader:B站视频下载工具,大会员4K与充电视频一次拿下 【免费下载链接】bilibili-downloader B站视频下载,支持下载大会员清晰度4K,持续更新中 项目地址: https://gitcode.com/gh_mirrors/bil/bilibili-do…

📅 2026/9/7 10:10:25
MORE NEWS

更多资讯

📰

Go并发调度器MPG模型与工作窃取算法解析

1. Go并发调度器的设计哲学Go语言最引以为傲的特性就是其原生支持的并发模型。与传统的线程池方案不同,Go的并发调度器采用了一种称为MPG模型的独特设计。这种设计源于Rob Pike等人对现代多核处理器架构的深刻理解——当CPU核心数量越来越多时,基于操作系…

📰

八大AI架构选型指南:从可控性权衡到工业落地

1. 这不是“架构图合集”,而是一份能真正用起来的AI系统设计手记“八大AI架构指南”——看到这个标题,很多人第一反应是:又一份PPT式概念罗列?配几张模糊的框图,贴几个耳熟能详的名字(Transformer、RAG、Mi…

📰

Word段落底端对齐:精准锚定页脚的排版核心技术

1. 项目概述:Word段落“钉”在页面底端的底层逻辑与真实场景你有没有遇到过这样的情况:一份正式的会议纪要末尾需要固定署名栏,或者毕业论文的指导教师签字位置必须严格位于页面最下方;又或者某份合同模板里,“甲方”“…

📰

2026年AI风向:Agent与多AI协作工作流成为落地核心

最近和几个做AI应用的朋友聊天,大家见面基本不问“你用的哪家模型”,而是问“你手里跑通了几个Agent”。这一句话的变化,其实已经把2026年初的行业风向说透了。今天是2月25日,我照例把全球AI前沿动态里值得跟踪的信息梳理了一遍&a…

📰

AI Agent与多智能体协作加速落地:2026年全球AI前沿动态盘点

1. 全球AI前沿动态总览:今天值得关注的几件事2026年2月25日这一天,全球AI圈的信息量依然很大。从大模型迭代到Agent落地,从AI编程辅助到内容生产工具,几乎每隔几个小时就有新东西冒出来。我自己从早上开始就陆续刷到好几条重磅消息…

📰

分布式模型预测控制在多智能体编队中的应用

1. 项目概述 多智能体协同编队控制是当前控制领域的热点研究方向,特别是在无人机集群、自动驾驶车队、工业机器人协作等场景中具有重要应用价值。作为一名长期从事智能控制研究的工程师,我最近复现了一篇SCI文献中基于分布式模型预测控制(DMP…

TODAY

今日更新

THIS WEEK

本周精选

THIS MONTH

本月热门

读完文章,想聊聊您的网站?

告诉我们您的行业与需求,资深顾问一对一梳理方案与报价,全程免费。

📞 💬