How can I get the Workspace ID of a Log Analytics workspace in Azure via C#?
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();