Is it possible to deploy a an Azure SQL database + server with only Azure Active Directory authentication via an ARM template?

John 101 Reputation points
2022-07-19T16:12:57.49+00:00

Hi all, I am wondering whether I can deploy a Azure SQL server + database and assign a Azure Active Directory admin at the same time. I saw someone asked this question 5 years ago and I was wondering whether it is possible now.

SQL Server on Azure Virtual Machines
Azure SQL Database
{count} vote

Accepted answer
  1. Alberto Morillo 32,711 Reputation points MVP
    2022-07-19T18:56:14.557+00:00

    Let me know if the following ARM template is what you are looking for:

    {  
        "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",  
        "contentVersion": "1.0.0.0",  
        "parameters": {  
            "SQL Administrator Login": {  
                "type": "String"  
            },  
            "SQL Administrator Password": {  
                "type": "SecureString"  
            },  
            "AAD Admin Login": {  
                "type": "String"  
            },  
            "AAD Admin ObjectID": {  
                "type": "String"  
            },  
            "AAD TenantId": {  
                "type": "String"  
            },  
            "Location (Region)": {  
                "type": "String"  
            },  
            "Server Name": {  
                "type": "String"  
            }  
        },  
        "variables": {},  
        "resources": [  
            {  
                "type": "Microsoft.Sql/servers",  
                "name": "[parameters('Server Name')]",  
                "apiVersion": "2014-04-01-preview",  
                "location": "[parameters('Location (Region)')]",  
                "properties": {  
                    "administratorLogin": "[parameters('SQL Administrator Login')]",  
                    "administratorLoginPassword": "[parameters('SQL Administrator Password')]",  
                    "version": "12.0"  
                },  
                "resources": [  
                    {  
                        "type": "firewallrules",  
                        "name": "AllowAllWindowsAzureIps",  
                        "apiVersion": "2014-04-01-preview",  
                        "location": "[parameters('Location (Region)')]",  
                        "properties": {  
                            "endIpAddress": "0.0.0.0",  
                           "startIpAddress": "0.0.0.0"  
                        },  
                        "dependsOn": [  
                            "[concat('Microsoft.Sql/servers/', parameters('Server Name'))]"  
                        ]  
                    },  
                    {  
                        "type": "administrators",  
                        "name": "activeDirectory",  
                        "apiVersion": "2014-04-01-preview",  
                        "location": "[parameters('Location (Region)')]",  
                        "properties": {  
                            "administratorType": "ActiveDirectory",  
                            "login": "[parameters('AAD Admin Login')]",  
                            "sid": "[parameters('AAD Admin ObjectID')]",  
                            "tenantId": "[parameters('AAD TenantID')]"  
                        },  
                        "dependsOn": [  
                            "[concat('Microsoft.Sql/servers/', parameters('Server Name'))]"  
                        ]  
                    }  
                ]  
            }  
        ]  
    }  
    

0 additional answers

Sort by: Most helpful