Issue context
When setting up Azure SQL database with auditing using Azure Blob Storage, you may encounter the following error:
The 'parameters.properties.storageAccountSubscriptionId' segment in the url is invalid.
The bicep resource code looks something like the following:
resource auditSettings 'Microsoft.Sql/servers/auditingSettings@2022-05-01-preview' = {
parent: kontextSqlServer
name: 'default'
properties: {
auditActionsAndGroups: [
'SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP'
'FAILED_DATABASE_AUTHENTICATION_GROUP'
'BATCH_COMPLETED_GROUP'
]
isAzureMonitorTargetEnabled: false
isDevopsAuditEnabled: false
isManagedIdentityInUse: false
isStorageSecondaryKeyInUse: false
retentionDays: 0
state: 'Enabled'
storageAccountSubscriptionId: subscription_id
storageEndpoint: sql_audit_blob_endpoint
}
}
subcription_id
and sql_audit_blob_endpoint
are parameters of string type.
Fix the issue
After spending some time to debug this issue, I found the error occurred because the parameter for subscription_id
is null or empty. After I ensure it is passed into the template correctly, the issue is resolved automatically.
storageAccountSubscriptionId: subscription_id
storageEndpoint: sql_audit_blob_endpoint
References
This error is different from the following one: