Fetch Log Analytics workspace alerts types configured in a csv using powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-798429%22%20slang%3D%22en-US%22%3EFetch%20Log%20Analytics%20workspace%20alerts%20types%20configured%20in%20a%20csv%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-798429%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20create%20a%20Powershell%20script%20to%20find%20the%20current%20configured%20alerts%20in%20a%20Azure%20subscription%20and%20save%20the%20data%20in%20a%20csv%20file.%20I%20am%20interested%20to%20get%20the%20%22Alert%20Types%22%20in%20my%20results%20for%20all%20the%20VM's%20for%20which%20Alerts%20are%20configured%20using%20Log%20Analytics%20workspac%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-798429%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApplication%20Insights%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowershell%20and%20Rest%20API%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-799569%22%20slang%3D%22en-US%22%3ERe%3A%20Fetch%20Log%20Analytics%20workspace%20alerts%20types%20configured%20in%20a%20csv%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-799569%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F389707%22%20target%3D%22_blank%22%3E%40SarthakChatterjee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-gb%2Fupdates%2Fnow-available-powershell-cmdlets-for-azure-monitor-metric-and-log-alerts%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fazure.microsoft.com%2Fen-gb%2Fupdates%2Fnow-available-powershell-cmdlets-for-azure-monitor-metric-and-log-alerts%2F%26nbsp%3B%20sepcifically%26nbsp%3B%3C%2FA%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-gb%2Fpowershell%2Fmodule%2Faz.monitor%2Fget-azscheduledqueryrule%3Fview%3Dazps-2.5.0%23code-try-3%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-gb%2Fpowershell%2Fmodule%2Faz.monitor%2Fget-azscheduledqueryrule%3Fview%3Dazps-2.5.0%23code-try-3%3C%2FA%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-gb%2Fupdates%2Fnow-available-powershell-cmdlets-for-azure-monitor-metric-and-log-alerts%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%26nbsp%3B%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EGet-AzScheduledQueryRule%20-ResourceGroupName%20%22fabrikamltdprod%22%20%7C%20where%20%7B%24_.Type%7D%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fplatform%2Falerts-log%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fplatform%2Falerts-log%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-799826%22%20slang%3D%22en-US%22%3ERe%3A%20Fetch%20Log%20Analytics%20workspace%20alerts%20types%20configured%20in%20a%20csv%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-799826%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20you%20give%20me%20any%20alias%20for%20this%20command%20in%20AzureRm%20modules%3F%20i%20don't%20have%20permission%20to%20install%20Az.Monitor%20in%20our%20central%20instance%20where%20i%20need%20to%20test%20this.%20Have%20AzureRm%20modules%20installed%20there%20already.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-802175%22%20slang%3D%22en-US%22%3ERe%3A%20Fetch%20Log%20Analytics%20workspace%20alerts%20types%20configured%20in%20a%20csv%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802175%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Clive%2C%20Would%20it%20be%20possible%20for%20you%20to%20tell%20me%20the%20alias%20command%20for%20this%20in%20AzureRm%20modules%20as%20i%20have%20that%20presently%20installed%20in%20my%20server%20where%20i%20need%20to%20configure%20this%3F%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-802215%22%20slang%3D%22en-US%22%3ERe%3A%20Fetch%20Log%20Analytics%20workspace%20alerts%20types%20configured%20in%20a%20csv%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802215%22%20slang%3D%22en-US%22%3E%3CP%3EI%20can%20see%20OperationalInsights%20having%20some%20cmdlets%20to%20cater%20to%20Log%20Analytics%20workspace%20for%20AzureRm%20module%20but%20not%20exactly%20able%20to%20pinpoint%20the%20cmdlet%20to%20use%20to%20fetch%20the%20alert%20types%20configured%20for%20a%20subscription.%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazurerm.operationalinsights%2F%3Fview%3Dazurermps-6.13.0%23operational_insights%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazurerm.operationalinsights%2F%3Fview%3Dazurermps-6.13.0%23operational_insights%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-802247%22%20slang%3D%22en-US%22%3ERe%3A%20Fetch%20Log%20Analytics%20workspace%20alerts%20types%20configured%20in%20a%20csv%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-802247%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F389707%22%20target%3D%22_blank%22%3E%40SarthakChatterjee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3ESorry%20I'm%20not%20familiar%20with%20those%2C%20maybe%20someone%20lease%20can%20help%3F%26nbsp%3B%20This%20link%20might%20help%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazurerm.resources%2Fget-azurermresource%3Fview%3Dazurermps-6.13.0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fazurerm.resources%2Fget-azurermresource%3Fview%3Dazurermps-6.13.0%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-819591%22%20slang%3D%22en-US%22%3ERe%3A%20Fetch%20Log%20Analytics%20workspace%20alerts%20types%20configured%20in%20a%20csv%20using%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-819591%22%20slang%3D%22en-US%22%3ECan%20anyone%20please%20help%20me%20with%20this%3F%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hello,

 

I want to create a Powershell script to find the current configured alerts in a Azure subscription and save the data in a csv file. I am interested to get the "Alert Types" in my results for all the VM's for which Alerts are configured using Log Analytics workspac

6 Replies
Highlighted

Can you give me any alias for this command in AzureRm modules? i don't have permission to install Az.Monitor in our central instance where i need to test this. Have AzureRm modules installed there already. 

Highlighted

Hi Clive, Would it be possible for you to tell me the alias command for this in AzureRm modules as i have that presently installed in my server where i need to configure this?

@Clive Watson 

Highlighted

I can see OperationalInsights having some cmdlets to cater to Log Analytics workspace for AzureRm module but not exactly able to pinpoint the cmdlet to use to fetch the alert types configured for a subscription.@Clive Watson 

 

https://docs.microsoft.com/en-us/powershell/module/azurerm.operationalinsights/?view=azurermps-6.13....

Highlighted
Highlighted
Can anyone please help me with this?