Reputation: 51
What would be the correct sequence to enable diagnostic settings for a resource in Azure?
I was trying Set-AzureRMDiagnosticSettings
in Powershell 5.0 to enable the settings on an MSSQL Paas database. But it doesn't seem to be working.
I am using the OMS workspace for diagnostic Settings.
Upvotes: 1
Views: 917
Reputation: 42043
You could try the command below, it works fine on my side. It enable Diagnostic settings
in azure sql database and pass the same to OMS workspace.
$workspaceName = '<OMSworkspaceName>'
$ResourceGroupName = '<ResourceGroupName>'
$oms=Get-AzureRmOperationalInsightsWorkspace -ResourceGroupName $ResourceGroupName -Name $workspaceName
$WSID = $oms.ResourceId
$resource = Get-AzureRmResource -ResourceGroupName <ResourceGroupName> -ResourceType Microsoft.Sql/servers/databases -ResourceName "<sqlservername>/<databasename>"
$resourceId = $resource.ResourceId
Set-AzureRmDiagnosticSetting -ResourceId $resourceId -WorkspaceId $WSID -Enable $True
Check in the portal:
Upvotes: 2