Create-AzDiagPolicy

2.0

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 and Log Analytics as sink points for selected resource types.

The owner has unlisted this package. This could mean that the script is deprecated or shouldn't be used anymore.

Installation Options

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

Install-Script -Name Create-AzDiagPolicy -RequiredVersion 2.0

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

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

Owners

Copyright

Microsoft

Package Details

Author(s)

  • jbritt@microsoft.com

Functions

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

Dependencies

This script has no dependencies.

Release Notes

June 07, 2020 2.0
Significant Updates this version which pushed it to 2.0!
* Special thanks to Dimitri Lider, and Julian Hayward (Microsoft) once again for their constant inputs on this script to improve!
* A HUGE THANK YOU to the ClearDATA crew for their support in bug bashing an early iteration of this 2.0 ver script before going broadly.
-- Thank you Jason Singh for leaning in on support for prioritizing review of this effort
-- And for Rob Sanders (https://github.com/rwsanders) for his isolation of a breaking bug I introduced that was much more easily isolated and resolved with his support!
* Another special call out to Kristian Nese @KristianNese (https://github.com/krnese) and Chris Eggert (https://github.com/pilor) @pilor
* for their technical review and big brain guidance related to approach and technical accuracy in the area of ARM and Policy!
Policy Initiative Support
- Added support for exporting to ARM Template Policy Initiative Artifact
-- Option for customized displayname for Initiative
-- Ability for Custom Azure Policies and Initiative to be idempotent due to creating a unique name via hash
--- Inspiration reference http://xpertkb.com/compute-hash-string-powershell/
User Experience
- Added logic to return to initial subscription context after successfully running the script (useful on Tenant / Management Group analysis)
- Improved token expiration experience for Azure Auth
- Added Total Execution Time to help understand performance of script against environment
- Updated Examples
Visual Updates
- Prettify function added to clean up JSON export
-- Inspiration via reference article / source: https://stackoverflow.com/questions/24789365/prettify-json-in-powershell-3/61988399#61988399
- Added process to clean up exported JSON
-- Credit to https://github.com/DeadPoolHeartsRR for their input on another script to use logic to use regex to clean up non printable chars (thank you! - Dead Pool Rocks BTW :) )
- Updated initial subscriptionId selection to show subscription name on screen.
Feature Enhancement
- Added "Kind" to evaluation to support RPs that leverage kind in category evaluation (Example: Azure SQL DW vs Azure SQL DB)

FileList

Version History

Version Downloads Last updated
2.9 3,239 9/9/2021