Azure Synapse Workspace
This page shows how to write Terraform and Azure Resource Manager for Synapse Workspace and write them securely.
azurerm_synapse_workspace (Terraform)
The Workspace in Synapse can be configured in Terraform with the resource name azurerm_synapse_workspace. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_synapse_workspace" "workspace_good" {
name = "example"
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "H@Sh1CoR3!"
managed_virtual_network_enabled = true
tags = {
resource "azurerm_synapse_workspace" "workspace_good" {
name = "example"
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "H@Sh1CoR3!"
managed_virtual_network_enabled = true
tags = {
resource "azurerm_synapse_workspace" "general" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
sql_administrator_login = "sqladminuser"
resource "azurerm_synapse_workspace" "synapse-experiments-ws" {
name = "synapsegitconfigws"
resource_group_name = azurerm_resource_group.synapse-experiments-rg.name
location = azurerm_resource_group.synapse-experiments-rg.location
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.synapse-experiments-fs.id
sql_administrator_login = "sqladminuser"
resource "azurerm_synapse_workspace" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
sql_administrator_login = "sqladminuser"
resource "azurerm_synapse_workspace" "workspace_good" {
name = "example"
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "H@Sh1CoR3!"
managed_virtual_network_enabled = true
tags = {
resource "azurerm_synapse_workspace" "synapse_workspace" {
name = var.name
resource_group_name = var.resource_group_name
location = var.location
storage_data_lake_gen2_filesystem_id = var.storage_data_lake_gen2_filesystem_id
sql_administrator_login = var.sql_administrator_login
resource "azurerm_synapse_workspace" "synapse_workspace" {
name = var.name
resource_group_name = var.resource_group_name
location = var.location
storage_data_lake_gen2_filesystem_id = var.storage_data_lake_gen2_filesystem_id
sql_administrator_login = var.sql_administrator_login
resource "azurerm_synapse_workspace" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
sql_administrator_login = "yourlogin"
resource "azurerm_synapse_workspace" "synapse" {
name = var.synapse_workspace_name
resource_group_name = module.resource_group.name
location = module.resource_group.location
storage_data_lake_gen2_filesystem_id = module.data_lake_gen2_filesystem.filesystem_id
sql_administrator_login = var.synapse_sql_username
Security Best Practices for azurerm_synapse_workspace
There is 1 setting in azurerm_synapse_workspace that should be taken care of for security reasons. The following section explain an overview and example code.
Ensure to enable the managed virtual network
It is better to enable the managed virtual network, which is disabled as the default.
Parameters
-
aad_adminoptional computed - list of object -
connectivity_endpointsoptional computed - map from string to string -
idoptional computed - string -
identityoptional computed - list of object-
principal_id- string -
tenant_id- string -
type- string
-
-
locationrequired - string -
managed_resource_group_nameoptional computed - string -
managed_virtual_network_enabledoptional - bool -
namerequired - string -
resource_group_namerequired - string -
sql_administrator_loginrequired - string -
sql_administrator_login_passwordrequired - string -
sql_identity_control_enabledoptional - bool -
storage_data_lake_gen2_filesystem_idrequired - string -
tagsoptional - map from string to string -
azure_devops_repolist block-
account_namerequired - string -
branch_namerequired - string -
project_namerequired - string -
repository_namerequired - string -
root_folderrequired - string
-
-
github_repolist block-
account_namerequired - string -
branch_namerequired - string -
git_urloptional - string -
repository_namerequired - string -
root_folderrequired - string
-
-
timeoutssingle block
Explanation in Terraform Registry
Manages a Synapse Workspace.
Microsoft.Synapse/workspaces (Azure Resource Manager)
The workspaces in Microsoft.Synapse can be configured in Azure Resource Manager with the resource name Microsoft.Synapse/workspaces. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceName": {
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceName": {
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceName": {
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceName": {
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceName": {
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceName": {
"type": "Microsoft.Synapse/workspaces",
"apiVersion": "2021-06-01",
"name": "[parameters('workspaces_mgdcworkspace_name')]",
"location": "westeurope",
"identity": {
"type": "SystemAssigned"
"type": "Microsoft.Synapse/workspaces",
"apiVersion": "2019-06-01-preview",
"name": "[parameters('workspaces_saw_name')]",
"location": "westus2",
"identity": {
"principalId": null,
"type": "Microsoft.Synapse/workspaces",
"apiVersion": "2021-06-01",
"name": "[parameters('WorkspaceName')]",
"location": "westeurope",
"identity": {
"type": "SystemAssigned"
"type": "Microsoft.Synapse/workspaces",
"apiVersion": "2020-12-01",
"tags": {},
"location": "[parameters('location')]",
"properties": {
"defaultDataLakeStorage": {
Parameters
apiVersionrequired - stringidentityoptionaltypeoptional - stringThe type of managed identity for the workspace.
userAssignedIdentitiesoptional - undefinedThe User Assigned Managed Identities.
locationrequired - stringThe geo-location where the resource lives
namerequired - stringThe name of the workspace.
propertiesrequiredazureADOnlyAuthenticationoptional - booleanEnable or Disable AzureADOnlyAuthentication on All Workspace subresource
connectivityEndpointsoptional - stringConnectivity endpoints
cspWorkspaceAdminPropertiesoptionalinitialWorkspaceAdminObjectIdoptional - stringAAD object ID of initial workspace admin
defaultDataLakeStorageoptionalaccountUrloptional - stringAccount URL
createManagedPrivateEndpointoptional - booleanCreate managed private endpoint to this storage account or not
filesystemoptional - stringFilesystem name
resourceIdoptional - stringARM resource Id of this storage account
encryptionoptionalcmkoptionalkekIdentityoptionaluserAssignedIdentityoptional - stringUser assigned identity resource Id
useSystemAssignedIdentityoptional - objectBoolean specifying whether to use system assigned identity or not
keyoptionalkeyVaultUrloptional - stringWorkspace Key sub-resource key vault url
nameoptional - stringWorkspace Key sub-resource name
managedResourceGroupNameoptional - stringWorkspace managed resource group. The resource group name uniquely identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90 characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.'
managedVirtualNetworkoptional - stringSetting this to 'default' will ensure that all compute for this workspace is in a virtual network managed on behalf of the user.
managedVirtualNetworkSettingsoptionalallowedAadTenantIdsForLinkingoptional - arrayAllowed Aad Tenant Ids For Linking
linkedAccessCheckOnTargetResourceoptional - booleanLinked Access Check On Target Resource
preventDataExfiltrationoptional - booleanPrevent Data Exfiltration
privateEndpointConnectionsoptional arraypropertiesoptionalprivateEndpointoptionalprivateLinkServiceConnectionStateoptionaldescriptionoptional - stringThe private link service connection description.
statusoptional - stringThe private link service connection status.
publicNetworkAccessoptional - stringEnable or Disable public network access to workspace.
purviewConfigurationoptionalpurviewResourceIdoptional - stringPurview Resource ID
sqlAdministratorLoginoptional - stringLogin for workspace SQL active directory administrator
sqlAdministratorLoginPasswordoptional - stringSQL administrator login password
virtualNetworkProfileoptionalcomputeSubnetIdoptional - stringSubnet ID used for computes in workspace
workspaceRepositoryConfigurationoptionalaccountNameoptional - stringAccount name
collaborationBranchoptional - stringCollaboration branch
hostNameoptional - stringGitHub Enterprise host name. For example: https://github.mydomain.com
lastCommitIdoptional - stringThe last commit ID
projectNameoptional - stringVSTS project name
repositoryNameoptional - stringRepository name
rootFolderoptional - stringRoot folder to use in the repository
tenantIdoptional - stringThe VSTS tenant ID
typeoptional - stringType of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration
tagsoptional - stringResource tags.
typerequired - string
Frequently asked questions
What is Azure Synapse Workspace?
Azure Synapse Workspace is a resource for Synapse of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Synapse Workspace?
For Terraform, the SnidermanIndustries/checkov-fork, melscoop-test/check and infracost/infracost source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the lordozb/github-4, nisinha/cicd and batorfi/synapsews source code examples are useful. See the Azure Resource Manager Example section for further details.