如何通过C#获取Azure Log Analytics工作区的工作区ID [英] How to get the Workspace ID of an Azure Log Analytics workspace via C#

查看:54
本文介绍了如何通过C#获取Azure Log Analytics工作区的工作区ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过C#获取Azure中Log Analytics工作区的工作区ID?

How can I get the Workspace ID of a Log Analytics workspace in Azure via C#?

推荐答案

此后,我发现也可以使用 OperationalInsightsManagementClient 类.

I've since found that the OperationalInsightsManagementClient class can be used as well.

var client = new OperationalInsightsManagementClient(GetCredentials()) {SubscriptionId = subscriptionId};
return (await client.Workspaces.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName))
    .Body
    .Select(w => w.CustomerId)
    .FirstOrDefault();

这篇关于如何通过C#获取Azure Log Analytics工作区的工作区ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆