Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
azurepolicy.json
azurepolicy.parameters.json Event Hub Policies for Azure Diags Mar 21, 2019
azurepolicy.rules.json Event Hub Policies for Azure Diags Mar 21, 2019

README.md

Apply Diagnostic Settings for Azure SQL to a Regional Event Hub

This policy automatically deploys diagnostic settings for Azure SQL supporting a regional Event Hub as a sink point.

Try on Portal

Deploy to Azure

Try with PowerShell

$definition = New-AzPolicyDefinition -Name "apply-diagnostic-setting-azsql-eventhub" -DisplayName "Apply Diagnostic Settings for Azure SQL to a Regional Event Hub" -description "This policy automatically deploys diagnostic settings for Azure SQL to point to a regional Event Hub." -Policy 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Monitoring/apply-diagnostic-setting-azsql-eventhub/azurepolicy.rules.json' -Parameter 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Monitoring/apply-diagnostic-setting-azsql-eventhub/azurepolicy.parameters.json' -Mode Indexed
$definition
$assignment = New-AzPolicyAssignment -Name <assignmentname> -Scope <scope> -profileName <profileName> -eventHubName <eventHubName> -eventHubRuleId <eventHubRuleId> -azureRegions <azureRegions> -metricsEnabled <metricsEnabled> -logsEnabled <logsEnabled> -PolicyDefinition $definition
$assignment 

Try with CLI


az policy definition create --name 'apply-diagnostic-setting-azsql-eventhub' --display-name 'Apply Diagnostic Settings for Azure SQL to a regional Event Hub' --description 'This policy automatically deploys diagnostic settings to Azure SQL DBs supporting a regional Event Hub.' --rules 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Monitoring/apply-diagnostic-setting-azsql-eventhub/azurepolicy.rules.json' --params 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Monitoring/apply-diagnostic-setting-azsql-eventhub/azurepolicy.parameters.json' --mode Indexed

az policy assignment create --name <assignmentname> --scope <scope> --params "{ 'profileName': { 'value': '<profileName>' }, 'eventHubName': { 'value': '<eventHubName>' },'eventHubRuleId': { 'value': '<eventHubRuleId>' },'azureRegions': { 'value': '<azureRegions>' },'metricsEnabled': { 'value': '<metricsEnabled>' },'logsEnabled': { 'value': '<logsEnabled>' } }" --policy "apply-diagnostic-setting-azsql-eventhub"

You can’t perform that action at this time.