Automating things using bicep for Azure deployment can be hard.
While it is trivially easy to find out how to configure maintenance windows for an SQL database using the Azure Portal directly, it is equally hard to find out how to set it using bicep deployment
No direct search gives any relevant links (apart from saying the the maintenanceConfigurationId
in the bicep-file must a “string”)
Finally found this, leading to an AzCli (or Azure Powershell) command, that can list default public standard servicewindows.
az maintenance public-configuration list
gives a quite long list
az maintenance public-configuration list –query “[?location==’westeurope’]” –output table
is better.
So in “West Europe” region, the standard Servicewindows are called:
– SQL_Default
– SQL_WestEurope_DB_1 (Mon – Thu)
– SQL_WestEurope_DB_2 (Fri – Sun)
and the full string used for maintenanceConfigurationId
would be /subscriptions/<<SUBSCRIPTION ID>>/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_WestEurope_DB_2
subscriptionResourceId(‘Microsoft.Maintenance/publicMaintenanceConfigurations’, ‘SQL_Default’)
$configurations = Get-AzMaintenancePublicConfiguration
$configurations | ?{ $_.Location -contains “westeurope” -and $_.MaintenanceScope -eq “SQLDB”} | Select-Object Location, ExtensionProperties, Name