title: Create SQL Server via Azure Resource Manager (ARM) template
body: <p>I am trying to create a new Azure instance of SQL Server in which I would like to then create a few new databases.</p>
  
  <p>I know from the Azure Portal that some sort of admin users could be:</p>
  
  <ul>
  <li>an <strong>SA</strong> user (I think this means "Server Admin" and it looks like some sort of old way of managing a SQL Server instance, but at the same time very "basic" and proved to work)</li>
  <li>an Active Directory user (not sure about Azure terminology here, but it looks like this could be some "broad user" for the whole Azure platform, like e.g. my own login user for the Azure Portal, this is not specific to databases world).</li>
  </ul>
  
  <p>I would like to create a SQL Server with a SA user to administer the server. <strong>From the Azure portal I can not find a way to generate an ARM template for a SA user for the SQL Server instance</strong>.</p>
  
  <p>I am copy pasting from a 10000 lines ARM template for a very long list of SQL servers and databases but I am not able to isolate the basic steps to have a hopefully clean and short ARM template to start with.</p>
  
  <p>This is the ARM template I am trying to deploy on Azure:</p>
  
  <pre><code>{
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "location": {
            "type": "string",
            "defaultValue": "westeurope"
          },
        "foo_sql_server_name": {
            "defaultValue": "foo-sql-server",
            "type": "String"
        }
      },
      "resources": [
        {
            "type": "Microsoft.Sql/servers",
            "kind": "v12.0",
            "name": "[parameters('foo_sql_server_name')]",
            "apiVersion": "2015-05-01-preview",
            "location": "[parameters('location')]",
            "scale": null,
            "properties": {
                "administratorLogin": "&lt;MY_SA_USER_THAT_I_CAN_NOT_CREATE&gt;",
                "version": "12.0"
            },
            "dependsOn": []
        }
      ]
  }
  </code></pre>
  
  <p>When running the above with:</p>
  
  <pre><code>az group deployment create \
    --name "deployDBs" \
    --resource-group "MyCustomResourceGroup" \
    --template-file ./templates/db.json # --verbose --debug
  </code></pre>
  
  <p>Then I get the following error message:</p>
  
  <pre><code>Deployment failed. Correlation ID: &lt;A_CUSTOM_GUID&gt;. {
    "status": "Failed",
    "error": {
      "code": "ResourceDeploymentFailure",
      "message": "The resource operation completed with terminal provisioning state 'Failed'.",
      "details": [
        {
          "code": "InvalidParameterValue",
          "message": "Invalid value given for parameter Password. Specify a valid parameter value."
        }
      ]
    }
  }
  </code></pre>
  
  <p>When removing the JSON field <code>administratorLogin</code> (because hopefully I could create the SA user somehow somewhere else that I yet have to figure out), then I get the following error message:</p>
  
  <pre><code>Deployment failed. Correlation ID: &lt;ANOTHER_CUSTOM_GUID&gt;. {
    "status": "Failed",
    "error": {
      "code": "ResourceDeploymentFailure",
      "message": "The resource operation completed with terminal provisioning state 'Failed'.",
      "details": [
        {
          "code": "InvalidParameterValue",
          "message": "Invalid value given for parameter Login. Specify a valid parameter value."
        }
      ]
    }
  }
  </code></pre>
  
  <p>I am not able to find the definition for the pair "username password" for the SA user (Server Admin) from the 10000 lines auto-generated ARM template.</p>
  
  <p>How could I create/inject a SA user for the SQL Server while deploying a new instance of a SQL Server?</p>