-
Notifications
You must be signed in to change notification settings - Fork 518
AzureMonitorBaselineAlerts
At present, Azure Monitor Baseline Alerts (AMBA) is not integrated into the ALZ-Bicep repository. However, this integration is underway and will soon be available.
If you prefer not to wait for this integration, you can deploy AMBA as a standalone deployment. This might be the optimal choice and also aligns with familiar scenarios, especially if you initially deployed the ALZ-Bicep framework using the PowerShell or Azure CLI scripts provided within the module READMEs. Follow the guidance provided in the AMBA documentation for deployment.
Alternatively, if you wish to integrate Azure Monitor Baseline Alerts into your existing Accelerator deployment, follow the guidance provided in the following sections.
Warning
The following guidance offers a simplified version of the integration and may differ from the final integration. This is provided for immediate solution.
Please ensure you have deployed the initial Accelerator and meet all prerequisites outlined in the AMBA prerequisites section for ALZ.
-
The first integration step to perform is to clone AMBA to your local machine.
-
Navigate to
patterns\alz
in the cloned AMBA repository and copy the following directories and files:
policyAssignments
policyDefinitions
policySetDefinitions
templates
alzARM.json
-
Paste the copied directories and files into a new directoy called
amba
within theconfig\custom-modules
directory of your ALZ-Bicep Accelerator repository. -
Navigate back to
patterns\alz
in the cloned AMBA repository and copy thealzARM.param.json
file. -
Paste the copied
alzARM.param.json
file into theconfig\custom-parameters
directory of your ALZ-Bicep Accelerator repository. -
Modify the
alzARM.param.json
file to incorporate your landing zone configuration. You can use the AMBA Parameter Configuration guidance as a reference point to understand how to configure the parameters. -
Next, go into
pipeline-scripts
and create a new script calledDeploy-AMBA.ps1
, which will be used to deploy the AMBA resources and called within your GitHub Actions Workflow or Azure Pipeline. -
Add the following code to the
Deploy-AMBA.ps1
script:
param (
[Parameter()]
[String]$Location = "$($env:LOCATION)",
[Parameter()]
[String]$TopLevelMGPrefix = "$($env:TOP_LEVEL_MG_PREFIX)",
[Parameter()]
[String]$TemplateURI = "https://raw.githubusercontent.com/Azure/azure-monitor-baseline-alerts/main/patterns/alz/alzArm.json",
[Parameter()]
[String]$TemplateParameterFile = "config\custom-parameters\alzArm.param.json",
[Parameter()]
[Boolean]$WhatIfEnabled = [System.Convert]::ToBoolean($($env:IS_PULL_REQUEST))
)
# Parameters necessary for deployment
$inputObject = @{
DeploymentName = 'alz-AMBADeploy-{0}' -f ( -join (Get-Date -Format 'yyyyMMddTHHMMssffffZ')[0..63])
Location = $Location
ManagementGroupId = $TopLevelMGPrefix
TemplateURI = $TemplateURI
TemplateParameterFile = $TemplateParameterFile
WhatIf = $WhatIfEnabled
Verbose = $true
}
New-AzManagementGroupDeployment @inputObject
-
Next, navigate to either
.azuredevOps\pipelines
or.github\workflows
and open thealz-bicep-1-core.yml
file. -
Depending upon which CI/CD platform you are using, you will need to modify the
alz-bicep-1-core.yml
file to include the following step after the Management Group deployment:
GitHub Action to Add (alz-bicep-1-core.yml)
- name: "AMBA Deployment"
uses: azure/powershell@v1
with:
inlineScript: |
.\pipeline-scripts\Deploy-AMBA.ps1
azPSVersion: "latest"
Azure Pipeline Task to Add (alz-bicep-1-core.yml)
- task: AzurePowerShell@5
displayName: "AMBA Deployment"
inputs:
azureSubscription: ${{ variables.SERVICE_CONNECTION_NAME }}
azurePowerShellVersion: "LatestVersion"
pwsh: true
ScriptType: "InlineScript"
Inline: |
.\pipeline-scripts\Deploy-AMBA.ps1
- Within the same
alz-bicep-1-core.yml
file, modify the path based triggers to include theconfig/custom-modules/amba/***
directory and theconfig/custom-parameters/amba.parameters.all.json
file. This will ensure that any changes to the AMBA resources will trigger a new build.
Note
For Azure Pipelines, if you are using Azure Repos as your repository, you will need to edit the branch policy of the main
branch to include the path based filters.
- Finally, commit the changes to your upstream repository, which will trigger a new build to deploy the AMBA resources.
Tip
If you have any issues with the deployment, please open an issue an issue within ALZ-Bicep
If you discover any documentation bugs or would like to request new content, please raise them as an issue on the repo.
Contributions to this wiki are done through the main repo under docs/wiki.
- Wiki Home
- Deployment Flow
- Consumer Guide
- How Does ALZ-Bicep Implement Azure Policies?
- How Does ALZ-Bicep Implement resilient deployments across availability zones?
- Contributing
- Telemetry Tracking Using Customer Usage Attribution (PID)
- Azure Container Registry Deployment - Private Bicep Registry
- Sample Pipelines
- Code tours