Skip to content

Commit

Permalink
feat: avm/res/synapse/workspace Entra ID administrator (Azure#2349)
Browse files Browse the repository at this point in the history
## Description

Fixes Azure#1071

## Pipeline Reference

| Pipeline |
| -------- |
|
[![avm.res.synapse.workspace](https://github.com/elanzel/bicep-registry-modules/actions/workflows/avm.res.synapse.workspace.yml/badge.svg?branch=synapse_administrators_child)](https://github.com/elanzel/bicep-registry-modules/actions/workflows/avm.res.synapse.workspace.yml)
|

## Type of Change

<!-- Use the checkboxes [x] on the options that are relevant. -->

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [ ] Azure Verified Module updates:
- [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [x] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [ ] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings
  • Loading branch information
elanzel authored Jun 20, 2024
1 parent 685a47b commit 7dbe747
Show file tree
Hide file tree
Showing 7 changed files with 473 additions and 1 deletion.
63 changes: 63 additions & 0 deletions avm/res/synapse/workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This module deploys a Synapse Workspace.
| `Microsoft.Network/privateEndpoints` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-04-01/privateEndpoints) |
| `Microsoft.Network/privateEndpoints/privateDnsZoneGroups` | [2023-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-04-01/privateEndpoints/privateDnsZoneGroups) |
| `Microsoft.Synapse/workspaces` | [2021-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Synapse/2021-06-01/workspaces) |
| `Microsoft.Synapse/workspaces/administrators` | [2021-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Synapse/2021-06-01/workspaces/administrators) |
| `Microsoft.Synapse/workspaces/integrationRuntimes` | [2021-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Synapse/2021-06-01/workspaces/integrationRuntimes) |
| `Microsoft.Synapse/workspaces/keys` | [2021-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Synapse/2021-06-01/workspaces/keys) |

Expand Down Expand Up @@ -346,6 +347,11 @@ module workspace 'br/public:avm/res/synapse/workspace:<version>' = {
name: 'swmax001'
sqlAdministratorLogin: 'synwsadmin'
// Non-required parameters
administrator: {
administratorType: 'ServicePrincipal'
login: 'dep-msi-swmax'
sid: '<sid>'
}
diagnosticSettings: [
{
eventHubAuthorizationRuleResourceId: '<eventHubAuthorizationRuleResourceId>'
Expand Down Expand Up @@ -469,6 +475,13 @@ module workspace 'br/public:avm/res/synapse/workspace:<version>' = {
"value": "synwsadmin"
},
// Non-required parameters
"administrator": {
"value": {
"administratorType": "ServicePrincipal",
"login": "dep-msi-swmax",
"sid": "<sid>"
}
},
"diagnosticSettings": {
"value": [
{
Expand Down Expand Up @@ -758,6 +771,7 @@ module workspace 'br/public:avm/res/synapse/workspace:<version>' = {
| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`accountUrl`](#parameter-accounturl) | string | The account URL of the data lake storage account. |
| [`administrator`](#parameter-administrator) | object | The Entra ID administrator for the synapse workspace. |
| [`allowedAadTenantIdsForLinking`](#parameter-allowedaadtenantidsforlinking) | array | Allowed AAD Tenant IDs For Linking. |
| [`azureADOnlyAuthentication`](#parameter-azureadonlyauthentication) | bool | Enable or Disable AzureADOnlyAuthentication on All Workspace sub-resource. |
| [`customerManagedKey`](#parameter-customermanagedkey) | object | The customer managed key definition. |
Expand Down Expand Up @@ -818,6 +832,55 @@ The account URL of the data lake storage account.
- Type: string
- Default: `[format('https://{0}.dfs.{1}', last(split(parameters('defaultDataLakeStorageAccountResourceId'), '/')), environment().suffixes.storage)]`

### Parameter: `administrator`

The Entra ID administrator for the synapse workspace.

- Required: No
- Type: object

**Required parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`administratorType`](#parameter-administratoradministratortype) | string | Workspace active directory administrator type. |
| [`login`](#parameter-administratorlogin) | securestring | Login of the workspace active directory administrator. |
| [`sid`](#parameter-administratorsid) | securestring | Object ID of the workspace active directory administrator. |

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`tenantId`](#parameter-administratortenantid) | securestring | Tenant ID of the workspace active directory administrator. |

### Parameter: `administrator.administratorType`

Workspace active directory administrator type.

- Required: Yes
- Type: string

### Parameter: `administrator.login`

Login of the workspace active directory administrator.

- Required: Yes
- Type: securestring

### Parameter: `administrator.sid`

Object ID of the workspace active directory administrator.

- Required: Yes
- Type: securestring

### Parameter: `administrator.tenantId`

Tenant ID of the workspace active directory administrator.

- Required: No
- Type: securestring

### Parameter: `allowedAadTenantIdsForLinking`

Allowed AAD Tenant IDs For Linking.
Expand Down
92 changes: 92 additions & 0 deletions avm/res/synapse/workspace/administrators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Synapse Workspaces Administrators `[Microsoft.Synapse/workspaces/administrators]`

This module deploys Synapse Workspaces Administrators.

## Navigation

- [Resource Types](#Resource-Types)
- [Parameters](#Parameters)
- [Outputs](#Outputs)
- [Cross-referenced modules](#Cross-referenced-modules)
- [Data Collection](#Data-Collection)

## Resource Types

| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.Synapse/workspaces/administrators` | [2021-06-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Synapse/2021-06-01/workspaces/administrators) |

## Parameters

**Required parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`administratorType`](#parameter-administratortype) | string | Workspace active directory administrator type. |
| [`login`](#parameter-login) | securestring | Login of the workspace active directory administrator. |
| [`sid`](#parameter-sid) | securestring | Object ID of the workspace active directory administrator. |

**Conditional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`workspaceName`](#parameter-workspacename) | string | The name of the parent Synapse Workspace. Required if the template is used in a standalone deployment. |

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`tenantId`](#parameter-tenantid) | string | Tenant ID of the workspace active directory administrator. |

### Parameter: `administratorType`

Workspace active directory administrator type.

- Required: Yes
- Type: string

### Parameter: `login`

Login of the workspace active directory administrator.

- Required: Yes
- Type: securestring

### Parameter: `sid`

Object ID of the workspace active directory administrator.

- Required: Yes
- Type: securestring

### Parameter: `workspaceName`

The name of the parent Synapse Workspace. Required if the template is used in a standalone deployment.

- Required: Yes
- Type: string

### Parameter: `tenantId`

Tenant ID of the workspace active directory administrator.

- Required: No
- Type: string
- Default: `[tenant().tenantId]`


## Outputs

| Output | Type | Description |
| :-- | :-- | :-- |
| `name` | string | The name of the deployed administrator. |
| `resourceGroupName` | string | The resource group of the deployed administrator. |
| `resourceId` | string | The resource ID of the deployed administrator. |

## Cross-referenced modules

_None_

## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
44 changes: 44 additions & 0 deletions avm/res/synapse/workspace/administrators/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
metadata name = 'Synapse Workspaces Administrators'
metadata description = 'This module deploys Synapse Workspaces Administrators.'
metadata owner = 'Azure/module-maintainers'

@description('Conditional. The name of the parent Synapse Workspace. Required if the template is used in a standalone deployment.')
param workspaceName string

@description('Required. Workspace active directory administrator type.')
param administratorType string

@description('Required. Login of the workspace active directory administrator.')
@secure()
param login string

@description('Required. Object ID of the workspace active directory administrator.')
@secure()
param sid string

@description('Optional. Tenant ID of the workspace active directory administrator.')
param tenantId string = tenant().tenantId

resource workspace 'Microsoft.Synapse/workspaces@2021-06-01' existing = {
name: workspaceName
}

resource synapse_workspace_administrator 'Microsoft.Synapse/workspaces/administrators@2021-06-01' = {
name: 'activeDirectory'
parent: workspace
properties: {
administratorType: administratorType
login: login
sid: sid
tenantId: tenantId
}
}

@description('The name of the deployed administrator.')
output name string = synapse_workspace_administrator.name

@description('The resource ID of the deployed administrator.')
output resourceId string = synapse_workspace_administrator.id

@description('The resource group of the deployed administrator.')
output resourceGroupName string = resourceGroup().name
83 changes: 83 additions & 0 deletions avm/res/synapse/workspace/administrators/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.28.1.47646",
"templateHash": "351030244990389212"
},
"name": "Synapse Workspaces Administrators",
"description": "This module deploys Synapse Workspaces Administrators.",
"owner": "Azure/module-maintainers"
},
"parameters": {
"workspaceName": {
"type": "string",
"metadata": {
"description": "Conditional. The name of the parent Synapse Workspace. Required if the template is used in a standalone deployment."
}
},
"administratorType": {
"type": "string",
"metadata": {
"description": "Required. Workspace active directory administrator type."
}
},
"login": {
"type": "securestring",
"metadata": {
"description": "Required. Login of the workspace active directory administrator."
}
},
"sid": {
"type": "securestring",
"metadata": {
"description": "Required. Object ID of the workspace active directory administrator."
}
},
"tenantId": {
"type": "string",
"defaultValue": "[tenant().tenantId]",
"metadata": {
"description": "Optional. Tenant ID of the workspace active directory administrator."
}
}
},
"resources": [
{
"type": "Microsoft.Synapse/workspaces/administrators",
"apiVersion": "2021-06-01",
"name": "[format('{0}/{1}', parameters('workspaceName'), 'activeDirectory')]",
"properties": {
"administratorType": "[parameters('administratorType')]",
"login": "[parameters('login')]",
"sid": "[parameters('sid')]",
"tenantId": "[parameters('tenantId')]"
}
}
],
"outputs": {
"name": {
"type": "string",
"metadata": {
"description": "The name of the deployed administrator."
},
"value": "activeDirectory"
},
"resourceId": {
"type": "string",
"metadata": {
"description": "The resource ID of the deployed administrator."
},
"value": "[resourceId('Microsoft.Synapse/workspaces/administrators', parameters('workspaceName'), 'activeDirectory')]"
},
"resourceGroupName": {
"type": "string",
"metadata": {
"description": "The resource group of the deployed administrator."
},
"value": "[resourceGroup().name]"
}
}
}
32 changes: 32 additions & 0 deletions avm/res/synapse/workspace/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ param defaultDataLakeStorageFilesystem string
@description('Optional. Create managed private endpoint to the default storage account or not. If Yes is selected, a managed private endpoint connection request is sent to the workspace\'s primary Data Lake Storage Gen2 account for Spark pools to access data. This must be approved by an owner of the storage account.')
param defaultDataLakeStorageCreateManagedPrivateEndpoint bool = false

@description('Optional. The Entra ID administrator for the synapse workspace.')
param administrator adminType

@description('Optional. The customer managed key definition.')
param customerManagedKey customerManagedKeyType

Expand Down Expand Up @@ -274,6 +277,18 @@ module workspace_key 'key/main.bicep' = if (encryptionActivateWorkspace) {
]
}

// - Workspace Entra ID Administrator
module workspace_administrator 'administrators/main.bicep' = if (!empty(administrator)) {
name: '${workspace.name}-administrator'
params: {
workspaceName: workspace.name
administratorType: administrator!.administratorType
login: administrator!.login
sid: administrator!.sid
tenantId: administrator.?tenantId
}
}

// Resource Lock
resource workspace_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') {
name: lock.?name ?? 'lock-${name}'
Expand Down Expand Up @@ -564,3 +579,20 @@ type customerManagedKeyType = {
@description('Optional. User assigned identity to use when fetching the customer managed key. Required if no system assigned identity is available for use.')
userAssignedIdentityResourceId: string?
}?

type adminType = {
@description('Required. Workspace active directory administrator type.')
administratorType: string

@description('Required. Login of the workspace active directory administrator.')
@secure()
login: string

@description('Required. Object ID of the workspace active directory administrator.')
@secure()
sid: string

@description('Optional. Tenant ID of the workspace active directory administrator.')
@secure()
tenantId: string?
}?
Loading

0 comments on commit 7dbe747

Please sign in to comment.