Unable to deploy SQL Server bicep template using AzureAD Authentication: true

Anonymous
2024-04-25T13:19:32.6266667+00:00

Hi,

I am deploying Azure SQL Server with administratorLoginPassword using Incremental mode but it is giving me error (AadOnlyAuthenticationIsEnabled). I need to use the password while deploying and I cannot ignore it.

Also, while deploying the sql server with conditional deployment if(deploySQLServer = false), it is still deploying to other resource groups. Kindly help, it is very important

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Oury Ba-MSFT 21,126 Reputation points Microsoft Employee Moderator
    2024-04-26T19:23:19.9666667+00:00

    @Srikanth Vanam (PERSISTENT SYSTEMS LIMITED)

    Seems like you are trying to create an Azure SQL server is AAD only authentication enable using bicep.

    I would suggest going through this template from this doc https://learn.microsoft.com/en-us/azure/templates/microsoft.sql/servers?pivots=deployment-language-bicep to check if you are not missing anything.

    User's image

    {

    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    
    "contentVersion": "1.0.0.1",
    
    "parameters": {
    
        "server": {
    
            "type": "string",
    
            "defaultValue": "[uniqueString('sql', resourceGroup().id)]",
    
            "metadata": {
    
                "description": "The name of the SQL logical server."
    
            }
    
        },
    
        "location": {
    
            "type": "string",
    
            "defaultValue": "[resourceGroup().location]",
    
            "metadata": {
    
                "description": "Location for all resources."
    
            }
    
        },
    
        "aad_admin_name": {
    
            "type": "String",
    
            "metadata": {
    
                "description": "The name of the Azure AD admin for the SQL server."
    
            }
    
        },
    
        "aad_admin_objectid": {
    
            "type": "String",
    
            "metadata": {
    
                "description": "The Object ID of the Azure AD admin."
    
            }
    
        },
    
        "aad_admin_tenantid": {
    
            "type": "String",
    
            "defaultValue": "[subscription().tenantId]",
    
            "metadata": {
    
                "description": "The Tenant ID of the Azure Active Directory"
    
            }
    
        },
    
        "aad_admin_type": {
    
            "defaultValue": "User",
    
            "allowedValues": [
    
                "User",
    
                "Group",
    
                "Application"
    
            ],
    
            "type": "String"
    
        },
    
        "aad_only_auth": {
    
            "defaultValue": true,
    
            "type": "Bool"
    
        }
    
    },
    
    "resources": [
    
        {
    
            "type": "Microsoft.Sql/servers",
    
            "apiVersion": "2020-11-01-preview",
    
            "name": "[parameters('server')]",
    
            "location": "[parameters('location')]",
    
            "properties": {
    
                "administrators": {
    
                    "login": "[parameters('aad_admin_name')]",
    
                    "sid": "[parameters('aad_admin_objectid')]",
    
                    "tenantId": "[parameters('aad_admin_tenantid')]",
    
                    "principalType": "[parameters('aad_admin_type')]",
    
                    "azureADOnlyAuthentication": "[parameters('aad_only_auth')]"
    
                }
    
            }
    
        }
    
    ]
    

    }

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.