Skip to content
11 changes: 10 additions & 1 deletion arm/Microsoft.Sql/servers/.parameters/parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
"secretName": "administratorLoginPassword"
}
},
"administrators": {
"value": {
"azureADOnlyAuthentication": false,
"login": "John Doe",
"sid": "<<deploymentSpId>>",
"principalType": "Application",
"tenantId": "<<tenantId>>"
}
},
"location": {
"value": "westeurope"
},
Expand Down Expand Up @@ -78,4 +87,4 @@
}
}
}
}
}
23 changes: 17 additions & 6 deletions arm/Microsoft.Sql/servers/deploy.bicep
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@description('Required. Administrator username for the server.')
param administratorLogin string
@description('Optional. Administrator username for the server. Required if no `administrators` object for AAD authentication is provided.')
param administratorLogin string = ''

@description('Required. The administrator login password.')
@description('Optional. The administrator login password. Required if no `administrators` object for AAD authentication is provided.')
@secure()
param administratorLoginPassword string
param administratorLoginPassword string = ''

@description('Optional. Location for all resources.')
param location string = resourceGroup().location
Expand Down Expand Up @@ -43,6 +43,9 @@ param firewallRules array = []
@description('Optional. The security alert policies to create in the server')
param securityAlertPolicies array = []

@description('Optional. The Azure Active Directory (AAD) administrator authentication. Required if no `administratorLogin` & `administratorLoginPassword` is provided.')
param administrators object = {}

var identityType = systemAssignedIdentity ? (!empty(userAssignedIdentities) ? 'SystemAssigned,UserAssigned' : 'SystemAssigned') : (!empty(userAssignedIdentities) ? 'UserAssigned' : 'None')

var identity = identityType != 'None' ? {
Expand All @@ -61,8 +64,16 @@ resource server 'Microsoft.Sql/servers@2021-05-01-preview' = {
tags: tags
identity: identity
properties: {
administratorLogin: administratorLogin
administratorLoginPassword: administratorLoginPassword
administratorLogin: !empty(administratorLogin) ? administratorLogin : null
administratorLoginPassword: !empty(administratorLoginPassword) ? administratorLoginPassword : null
administrators: !empty(administrators) ? {
administratorType: 'ActiveDirectory'
azureADOnlyAuthentication: administrators.azureADOnlyAuthentication
login: administrators.login
principalType: administrators.principalType
sid: administrators.sid
tenantId: administrators.tenantId
} : null
version: '12.0'
}
}
Expand Down
24 changes: 21 additions & 3 deletions arm/Microsoft.Sql/servers/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ This module deploys a SQL server.

| Parameter Name | Type | Default Value | Possible Values | Description |
| :-- | :-- | :-- | :-- | :-- |
| `administratorLogin` | string | | | Required. Administrator username for the server. |
| `administratorLoginPassword` | secureString | | | Required. The administrator login password. |
| `administratorLogin` | string | | | Optional. Administrator username for the server. Required if no `administrators` object for AAD authentication is provided. |
| `administratorLoginPassword` | secureString | | | Optional. The administrator login password. Required if no `administrators` object for AAD authentication is provided. |
| `administrators` | object | `{object}` | | Optional. The Azure Active Directory (AAD) administrator authentication. Required if no `administratorLogin` & `administratorLoginPassword` is provided. |
| `cuaId` | string | | | Optional. Customer Usage Attribution ID (GUID). This GUID must be previously registered |
| `databases` | _[databases](databases/readme.md)_ array | `[]` | | Optional. The databases to create in the server |
| `firewallRules` | _[firewallRules](firewallRules/readme.md)_ array | `[]` | | Optional. The firewall rules to create in the server |
Expand All @@ -28,7 +29,7 @@ This module deploys a SQL server.
| `name` | string | | | Required. The name of the server. |
| `roleAssignments` | array | `[]` | | Optional. Array of role assignment objects that contain the 'roleDefinitionIdOrName' and 'principalId' to define RBAC role assignments on this resource. In the roleDefinitionIdOrName attribute, you can provide either the display name of the role definition, or its fully qualified ID in the following format: '/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11' |
| `securityAlertPolicies` | _[securityAlertPolicies](securityAlertPolicies/readme.md)_ array | `[]` | | Optional. The security alert policies to create in the server |
| `systemAssignedIdentity` | bool | | | Optional. Enables system assigned managed identity on the resource. |
| `systemAssignedIdentity` | bool | `False` | | Optional. Enables system assigned managed identity on the resource. |
| `tags` | object | `{object}` | | Optional. Tags of the resource. |
| `userAssignedIdentities` | object | `{object}` | | Optional. The ID(s) to assign to the resource. |

Expand Down Expand Up @@ -84,6 +85,23 @@ You can specify multiple user assigned identities to a resource by providing add
},
```

### Parameter Usage: `administrators`

Configure Azure Active Directory Authentication method for server administrator.
https://docs.microsoft.com/en-us/azure/templates/microsoft.sql/servers/administrators?tabs=bicep

```json
"administrators": {
"value": {
"azureADOnlyAuthentication": false
"login": "John Doe"
"sid": "<<objectId>>"
"principalType" : "User" // options: "User", "Group", "Application"
"tenantId": "<<tenantId>>"
}
},
```

## Outputs

| Output Name | Type | Description |
Expand Down