Is there a way to get which Log Analytics Workspace an Azure Resource belongs to using Powershell?

2.6k Views Asked by At

I'm looking for a way to obtain which OMS workspace my APIM Services resource is logging to using PowerShell. I want to then configure my Application Gateway to log to the same workspace.

When I go to "Logs" under the APIM service, it shows all available workspaces in my subscription.

I'm not sure how to get just the workspace that it is logging to.

1

There are 1 best solutions below

1
On

This is not really a PowerShell Code errors / functionality issue, but how do I find and match up my AzureRM resources and extract information.

However, since you are here...

If the property is not there, then you are not looking at the correct resource cmdlet / object. I don't have this type of scenario deployed in my sub, so no way to dig at it. Take a look at this

Workspaces - Get

URI Parameters Name In Required Type Description subscriptionId path True string Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. resourceGroupName path True string The resource group name of the workspace. workspaceName path True string Name of the Log Analytics Workspace. api-version query True string Client Api Version.

And use the provided properties to cross reference, specifically the resourceGroupName and or workspaceName.