Facing Ext_StorageConfigurationSettings_ArgumentError Issue while deploying Azure SQL VM via Bicep – Storage Configuration Error and Default File Path Not Applied
Facing Ext_StorageConfigurationSettings_ArgumentError Issue while deploying Azure SQL VM via Bicep – Storage Configuration Error and Default File Path Not Applied
I am deploying an Azure SQL Virtual Machine using Bicep, but I’m encountering an error related to the storage configuration during the SQL VM deployment.
Error Message:
Error: 'Failed to get valid physical disks within given device ID range.' (Code: Ext_StorageConfigurationSettings_ArgumentError)
In addition to this, I’m also trying to customize the defaultFilePath for sqlDataSettings and sqlLogSettings, but the deployment seems to ignore these values and instead uses the default system paths.
Code:
resource dataDiskResources 'Microsoft.Compute/disks@2022-03-02' = [for i in range(0, dataDiskCount): { name: '${name}-datadisk-${i}' location: location sku: { name: 'Premium_LRS' } properties: { diskSizeGB: dataDiskSizeGB creationData: { createOption: 'Empty' } } }]
resource vm 'Microsoft.Compute/virtualMachines@2024-11-01' = { name: name location: location tags: tags zones: zone != 0 ? array(string(zone)) : null plan: !empty(plan) ? plan : null properties: { hardwareProfile: { vmSize: vmSize } securityProfile: { securityType: securityType uefiSettings: securityType == 'TrustedLaunch' ? { secureBootEnabled: true vTpmEnabled: true } : null } storageProfile: { dataDisks: [ for i in range(0, dataDiskCount): { lun: i createOption: 'Attach' managedDisk: { id: resourceId('Microsoft.Compute/disks', '${name}-datadisk-${i}') } } ]
imageReference: {
publisher: 'MicrosoftSQLServer'
offer: vmImageOffer
sku: vmImageSKU
version: 'latest'
}
osDisk: {
name: '${name}-OsDisk'
createOption: osDiskCreateOption
managedDisk: {
storageAccountType: osDiskstorageAccountType
}
}
}}
resource guestAttestationExtension 'Microsoft.Compute/virtualMachines/extensions@2022-03-01' = {
parent: vm
name: extensionName
location: location
properties: {
publisher: extensionPublisher
type: extensionName
typeHandlerVersion: extensionVersion
autoUpgradeMinorVersion: true
enableAutomaticUpgrade: true
settings: {
AttestationConfig: {
MaaSettings: {
maaEndpoint: ''
maaTenantName: maaTenantName
}
AscSettings: {
ascReportingEndpoint: ''
ascReportingFrequency: ''
}
useCustomToken: 'false'
disableAlerts: 'false'
}
}
}
dependsOn: [
vm
]
}
resource sqlVirtualMachine 'Microsoft.SqlVirtualMachine/SqlVirtualMachines@2022-07-01-preview' = {
name: name
location: location
properties: {
virtualMachineResourceId: resourceId('Microsoft.Compute/virtualMachines', name)
sqlManagement: 'Full'
sqlServerLicenseType: 'AHUB'
keyVaultCredentialSettings: {
enable: false
credentialName: ''
}
storageConfigurationSettings: {
diskConfigurationType: sqlStorageDisksConfigurationType
storageWorkloadType: sqlStorageWorkloadType
sqlDataSettings: {
luns: dataDisksLuns
defaultFilePath: dataPath
}
sqlLogSettings: {
luns: logDisksLuns
defaultFilePath: logPath
}
sqlTempDbSettings: {
defaultFilePath: tempDbPath
}
sqlSystemDbOnDataDisk: false
}
}}