This script takes a SubscriptionID, ResourceType, ResourceGroup as parameters, analyzes the subscription or
specific ResourceGroup defined for the resources specified in $Resources, and builds a custom policy for
diagnostic metrics/logs for Event Hubs, Storage and Log Analytics as sink points for selected resource types.

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Create-AzDiagPolicy

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More






BuildBody Get-ResourceType Add-IndexNumberToArray New-LogArray New-MetricArray Update-LogAnalyticsJSON Update-EventHubJSON Update-StorageJSON Parse-ResourceType Validate-JSON New-PolicyInitiative Format-JSON Create-Hash


This script has no dependencies.

Release Notes

May 05, 2021 2.8
* Adding the ability to leverage a dedicated table (instead of AzureDiagnostics) for resourceTypes that support it
Reference Link:
THANK YOU Eric Golpe (Principal Cloud Solution Architect) - Microsoft for leaning in and driving this change on behalf of a customer requirement.
Note: Utilize -Dedicated switch to enable.  This will be a blanket configuration for all policies and will only enable for those resourceTypes that
support it.  Otherwise, the default will be AzureDiagnostics table

Version History

Version Downloads Last updated
2.8 (current version) 23 5/25/2021