Gallery › SQL › Azure built-in policies
[Deprecated]: Configure Arc-enabled machines running SQL Server to have SQL Server extension installed.
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 3.4.1-deprecated Deprecated
To ensure that SQL Server - Azure Arc resources are created by default when SQL Server instance is found on Azure Arc enabled Windows/Linux Server, the latter should have the SQL Server extension installed. This policy is deprecated because we are migrating to a more streamlined. recommended and automated process of onboarding Arc Servers with SQL installed onto the Azure extension for SQL Server. Learn more about the auto-onboarding process at https://aka.ms/SQLServerExtensionPolicyDeprecation
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "[Deprecated]: Configure Arc-enabled machines running SQL Server to have SQL Server extension installed.",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "To ensure that SQL Server - Azure Arc resources are created by default when SQL Server instance is found on Azure Arc enabled Windows/Linux Server, the latter should have the SQL Server extension installed. This policy is deprecated because we are migrating to a more streamlined. recommended and automated process of onboarding Arc Servers with SQL installed onto the Azure extension for SQL Server. Learn more about the auto-onboarding process at https://aka.ms/SQLServerExtensionPolicyDeprecation",
"metadata": {
"version": "3.4.1-deprecated",
"category": "SQL",
"deprecated": true
},
"version": "3.4.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "DeployIfNotExists",
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
},
"licenseType": {
"type": "String",
"metadata": {
"displayName": "License type",
"description": "Specify the SQL Server license type you are using on this machine."
},
"allowedValues": [
"Paid",
"PAYG",
"LicenseOnly"
],
"defaultValue": "Paid"
},
"excludedSqlInstances": {
"type": "Array",
"metadata": {
"displayName": "Excluded SQL Instance names",
"description": "Specify the names of SQL Server instances that you want to exclude from onboarding to Azure Arc."
},
"defaultValue": []
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/machines/mssqlDiscovered",
"equals": "true"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.HybridCompute/machines/extensions",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/7392c568-9289-4bde-aaaa-b7131215889d"
],
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.HybridCompute/machines/extensions/publisher",
"equals": "Microsoft.AzureData"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/provisioningState",
"in": [
"Creating",
"Succeeded"
]
},
{
"anyOf": [
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "WindowsAgent.SqlServer"
},
{
"field": "Microsoft.HybridCompute/machines/extensions/type",
"equals": "LinuxAgent.SqlServer"
}
]
}
]
},
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"agentName": {
"type": "string"
},
"licenseType": {
"type": "string"
},
"excludedSqlInstances": {
"type": "array"
}
},
"variables": {
"vmExtensionName": "[parameters('agentName')]",
"vmExtensionPublisher": "Microsoft.AzureData",
"vmExtensionType": "[parameters('agentName')]"
},
"resources": [
{
"name": "[concat(parameters('vmName'), '/', variables('vmExtensionName'))]",
"type": "Microsoft.HybridCompute/machines/extensions",
"location": "[parameters('location')]",
"apiVersion": "2019-12-12",
"properties": {
"publisher": "[variables('vmExtensionPublisher')]",
"type": "[variables('vmExtensionType')]",
"settings": {
"SqlManagement": {
"IsEnabled": true
},
"ExcludedSqlInstances": "[parameters('excludedSqlInstances')]",
"LicenseType": "[parameters('licenseType')]"
}
}
}
],
"outputs": {
"policy": {
"type": "string",
"value": "[concat('Enabled extension for VM', ': ', parameters('vmName'))]"
}
}
},
"parameters": {
"vmName": {
"value": "[field('name')]"
},
"location": {
"value": "[field('location')]"
},
"agentName": {
"value": "[if(startsWith(field('Microsoft.HybridCompute/machines/osName'),'windows'), 'WindowsAgent.SqlServer', 'LinuxAgent.SqlServer')]"
},
"licenseType": {
"value": "[parameters('licenseType')]"
},
"excludedSqlInstances": {
"value": "[parameters('excludedSqlInstances')]"
}
}
}
}
}
}
},
"versions": [
"3.4.1",
"3.4.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/fd2d1a6e-6d95-4df2-ad00-504bf0273406",
"name": "fd2d1a6e-6d95-4df2-ad00-504bf0273406"
}# Converted from ArcMachineWithSQL_InstallArcEnabledExtension.json by ConvertTo-Bylaw.
Policy 'fd2d1a6e-6d95-4df2-ad00-504bf0273406' {
Properties @{
DisplayName = '[Deprecated]: Configure Arc-enabled machines running SQL Server to have SQL Server extension installed.'
Description = 'To ensure that SQL Server - Azure Arc resources are created by default when SQL Server instance is found on Azure Arc enabled Windows/Linux Server, the latter should have the SQL Server extension installed. This policy is deprecated because we are migrating to a more streamlined. recommended and automated process of onboarding Arc Servers with SQL installed onto the Azure extension for SQL Server. Learn more about the auto-onboarding process at https://aka.ms/SQLServerExtensionPolicyDeprecation'
Version = '3.4.1-deprecated'
Category = 'SQL'
Deprecated = $true
PolicyVersion = '3.4.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter LicenseType @{
AllowedValues = @('Paid', 'PAYG', 'LicenseOnly')
Default = 'Paid'
DisplayName = 'License type'
Description = 'Specify the SQL Server license type you are using on this machine.'
}
Parameter ExcludedSqlInstances @{
Type = 'Array'
Default = @()
DisplayName = 'Excluded SQL Instance names'
Description = 'Specify the names of SQL Server instances that you want to exclude from onboarding to Azure Arc.'
}
Resource 'Microsoft.HybridCompute/machines' {
Require 'mssqlDiscovered is not true' {
Field mssqlDiscovered | Must -Not -Be 'true' -IfPresent
}
}
DeployIfNotExists 'Microsoft.HybridCompute/machines/extensions' -Role 'Azure Extension for SQL Server Deployment' -Effect (Param Effect) {
Require 'publisher, provisioningState and type are as required' {
Field publisher | Must -Be 'Microsoft.AzureData'
Field provisioningState | Must -BeIn @('Creating', 'Succeeded')
AnyOf {
Field 'Microsoft.HybridCompute/machines/extensions/type' | Must -Be 'WindowsAgent.SqlServer'
Field 'Microsoft.HybridCompute/machines/extensions/type' | Must -Be 'LinuxAgent.SqlServer'
}
}
Deployment -TemplateFile './templates/fd2d1a6e-6d95-4df2-ad00-504bf0273406.json' -Parameters ([ordered]@{
vmName = (Arm '[field(''name'')]')
location = (Arm '[field(''location'')]')
agentName = (Arm '[if(startsWith(field(''Microsoft.HybridCompute/machines/osName''),''windows''), ''WindowsAgent.SqlServer'', ''LinuxAgent.SqlServer'')]')
licenseType = (Param LicenseType)
excludedSqlInstances = (Param ExcludedSqlInstances)
})
}
}Its deployment templates are written beside it:
templates/fd2d1a6e-6d95-4df2-ad00-504bf0273406.json
Source: built-in-policies/policyDefinitions/SQL/ArcMachineWithSQL_InstallArcEnabledExtension.json in Azure/azure-policy, under the MIT licence.
Bylaw