SqlIaasExtension in ARM template intermittently configures SQL Authentication

Donovin DeCoste (ddecoste) 1 Reputation point
2022-07-05T10:33:48.317+00:00

Hi there,

We have had an ARM template using SQLIassExtension to configure a SQL VM for many years. Recently what we are observing is sometimes SQL Authentication is being enabled and other times it is being disabled using the exact same template with no changes. We need this to be enabled and consistently be enabled on creation.

217677-image.png

I tried several things including updating the extension api from the 2015 version to apiVersion 2020-12-01 with no success. I've attached both versions of the arm template below to show that both instanced were unsuccessful and showed the same behavior.

Below is a copy of the older ARM template used

============================

{  
  "apiVersion": "2015-06-15",  
  "type": "Microsoft.Compute/virtualMachines/extensions",  
  "name": "[concat(variables('vmSQLName'), '/SqlIaasExtension')]",  
  "location": "[resourceGroup().location]",  
  "dependsOn": [  
    "[resourceId('Microsoft.Compute/virtualMachines', variables('vmSQLName'))]"  
  ],  
  "properties": {  
    "type": "SqlIaaSAgent",  
    "publisher": "Microsoft.SqlServer.Management",  
    "typeHandlerVersion": "1.2",  
    "autoUpgradeMinorVersion": "true",  
    "settings": {  
      "AutoTelemetrySettings": {  
        "Region": "[resourceGroup().location]"  
      },  
      "AutoPatchingSettings": {  
        "PatchCategory": "WindowsMandatoryUpdates",  
        "Enable": true,  
        "DayOfWeek": "Sunday",  
        "MaintenanceWindowStartingHour": "2",  
        "MaintenanceWindowDuration": "60"  
      },  
      "KeyVaultCredentialSettings": {  
        "Enable": false,  
        "CredentialName": ""  
      },  
      "ServerConfigurationsManagementSettings": {  
        "SQLConnectivityUpdateSettings": {  
          "ConnectivityType": "Private",  
          "Port": "1433"  
        },  
        "SQLWorkloadTypeUpdateSettings": {  
          "SQLWorkloadType": "GENERAL"  
        },  
        "SQLStorageUpdateSettings": {  
          "DiskCount": "1",  
          "NumberOfColumns": "1",  
          "StartingDeviceID": "2",  
          "DiskConfigurationType": "NEW"  
        },  
        "AdditionalFeaturesServerConfigurations": {  
          "IsRServicesEnabled": "false"  
        }  
      }  
    },  
    "protectedSettings": {  
      "SQLAuthUpdateUserName": "[parameters('adminUsername')]",  
      "SQLAuthUpdatePassword": "[parameters('adminPassword')]"  
    }  
  },  
  "tags": {  
    "displayName": "AddSQLServerDisk"  
  }  
},  

============================================

and below is the newer API used with additional settings under the ServerConfigurationsManagementSettings area

============================================

{  
  "apiVersion": "2020-12-01",  
  "type": "Microsoft.Compute/virtualMachines/extensions",  
  "name": "[concat(variables('vmSQLName'), '/SqlIaasExtension')]",  
  "location": "[resourceGroup().location]",  
  "dependsOn": [  
    "[resourceId('Microsoft.Compute/virtualMachines', variables('vmSQLName'))]"  
  ],  
  "properties": {  
    "type": "SqlIaaSAgent",  
    "publisher": "Microsoft.SqlServer.Management",  
    "typeHandlerVersion": "1.2",  
    "autoUpgradeMinorVersion": "true",  
    "settings": {  
      "AutoTelemetrySettings": {  
        "Region": "[resourceGroup().location]"  
      },  
      "AutoPatchingSettings": {  
        "PatchCategory": "WindowsMandatoryUpdates",  
        "Enable": true,  
        "DayOfWeek": "Sunday",  
        "MaintenanceWindowStartingHour": "2",  
        "MaintenanceWindowDuration": "60"  
      },  
      "KeyVaultCredentialSettings": {  
        "Enable": false,  
        "CredentialName": ""  
      },  
      "ServerConfigurationsManagementSettings": {  
        "SQLConnectivityUpdateSettings": {  
          "SqlAuthUpdateUserName": "[parameters('adminUsername')]",  
          "SqlAuthUpdatePassword": "[parameters('adminPassword')]",  
          "ConnectivityType": "Private",  
          "Port": "1433"  
        },  
        "SQLWorkloadTypeUpdateSettings": {  
          "SQLWorkloadType": "GENERAL"  
        },  
        "SQLStorageUpdateSettings": {  
          "DiskCount": "1",  
          "NumberOfColumns": "1",  
          "StartingDeviceID": "2",  
          "DiskConfigurationType": "NEW"  
        },  
        "AdditionalFeaturesServerConfigurations": {  
          "IsRServicesEnabled": "false"  
        }  
      }  
    },  
    "protectedSettings": {  
      "SQLAuthUpdateUserName": "[parameters('adminUsername')]",  
      "SQLAuthUpdatePassword": "[parameters('adminPassword')]"  
    }  
  },  
  "tags": {  
    "displayName": "AddSQLServerDisk"  
  }  
},  

================================================

SQL Server on Azure Virtual Machines
{count} votes