Skip to content

Commit 587ebda

Browse files
committed
adding synapse managed vnet feature
1 parent 9fdc298 commit 587ebda

File tree

4 files changed

+67
-24
lines changed

4 files changed

+67
-24
lines changed

deploy/infra/groups/pipeline.bicep

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ param synapseMIStorageAccountRoles array = [
8484
]
8585

8686
param logAnalyticsWorkspaceId string
87+
param securityEnabled bool = false
88+
param preventDataExfiltration bool = false
8789

8890
var namingPrefix = '${environmentCode}-${projectName}'
8991
var synapseResourceGroupNameVar = empty(synapseResourceGroupName) ? '${namingPrefix}-rg' : synapseResourceGroupName
@@ -129,8 +131,6 @@ module synapseHnsStorageAccount '../modules/storage.hns.bicep' = {
129131
}
130132
}
131133

132-
133-
134134
module synapseWorkspace '../modules/synapse.workspace.bicep' = {
135135
name: '${namingPrefix}-workspace'
136136
params:{
@@ -153,6 +153,8 @@ module synapseWorkspace '../modules/synapse.workspace.bicep' = {
153153
gitRepoRootFolder: synapseGitRepoRootFolder
154154
gitRepoVstsTenantId: synapseGitRepoVstsTenantId
155155
gitRepoType: synapseGitRepoType
156+
createManagedVnet: securityEnabled
157+
preventDataExfiltration: preventDataExfiltration
156158
}
157159
dependsOn: [
158160
synapseHnsStorageAccount

deploy/infra/main.bicep

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ param environmentCode string
1414
@description('Environment will be used as Tag on the resource group')
1515
param environment string
1616

17+
@description('Flag to set whether security resources such as Synapse managed vnet, NSG, etc are created or not')
18+
param securityEnabled bool = false
19+
20+
@description('preventDataExfiltration for Synapse managed vnet')
21+
param preventDataExfiltration bool = false
22+
1723
@description('Used for naming of the network resource group and its resources')
1824
param networkModulePrefix string = 'network'
1925

@@ -105,6 +111,8 @@ module pipelineModule 'groups/pipeline.bicep' = {
105111
environmentCode: environmentCode
106112
environmentTag: environment
107113
logAnalyticsWorkspaceId: monitorModule.outputs.workspaceId
114+
securityEnabled: securityEnabled
115+
preventDataExfiltration: preventDataExfiltration
108116
}
109117
dependsOn: [
110118
networkModule

deploy/infra/modules/synapse.workspace.bicep

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,49 @@ param synapseSqlAdminPasswordSecretName string = 'synapse-sqladmin-password'
2626
param utcValue string = utcNow()
2727
param workspaceId string = 'default'
2828

29+
param createManagedVnet bool = false
30+
@allowed([
31+
'default'
32+
''
33+
])
34+
param managedVirtualNetwork string = 'default'
35+
param preventDataExfiltration bool = false
36+
param managedVirtualNetworkSettings object = {
37+
managedVirtualNetworkSettings : {
38+
allowedAadTenantIdsForLinking: []
39+
preventDataExfiltration: preventDataExfiltration
40+
}
41+
managedVirtualNetwork : managedVirtualNetwork
42+
}
43+
44+
45+
var defaultDataLakeStorageSettings = {
46+
resourceId: hnsStorage.id
47+
accountUrl: hnsStorage.properties.primaryEndpoints.dfs
48+
filesystem: hnsStorageFileSystem
49+
}
50+
var createManagedPrivateEndpointSetting = {
51+
createManagedPrivateEndpoint : preventDataExfiltration
52+
}
53+
var datalakeStorageSettings = createManagedVnet ? union(defaultDataLakeStorageSettings, createManagedPrivateEndpointSetting) : defaultDataLakeStorageSettings
54+
var synapseCommonProperties = {
55+
defaultDataLakeStorage: datalakeStorageSettings
56+
sqlAdministratorLogin: sqlAdminLogin
57+
sqlAdministratorLoginPassword: sqlAdminLoginPassword
58+
workspaceRepositoryConfiguration:(empty(gitRepoType))? {}: {
59+
accountName: gitRepoAccountName
60+
collaborationBranch: gitRepoCollaborationBranch
61+
hostName: gitRepoHostName
62+
lastCommitId: gitRepoLastCommitId
63+
projectName: gitRepoVstsProjectName
64+
repositoryName: gitRepoRepositoryName
65+
rootFolder: gitRepoRootFolder
66+
tenantId: gitRepoVstsTenantId
67+
type: gitRepoType
68+
}
69+
}
70+
var selectedSynapseProperties = createManagedVnet ? union(synapseCommonProperties, managedVirtualNetworkSettings) : synapseCommonProperties
71+
2972
resource hnsStorage 'Microsoft.Storage/storageAccounts@2021-08-01' existing = {
3073
name: hnsStorageAccountName
3174
}
@@ -40,26 +83,7 @@ resource synapseWorspace 'Microsoft.Synapse/workspaces@2021-06-01' = {
4083
identity: {
4184
type: 'SystemAssigned'
4285
}
43-
properties: {
44-
defaultDataLakeStorage: {
45-
resourceId: hnsStorage.id
46-
accountUrl: hnsStorage.properties.primaryEndpoints.dfs
47-
filesystem: hnsStorageFileSystem
48-
}
49-
sqlAdministratorLogin: sqlAdminLogin
50-
sqlAdministratorLoginPassword: sqlAdminLoginPassword
51-
workspaceRepositoryConfiguration:(empty(gitRepoType))? {}: {
52-
accountName: gitRepoAccountName
53-
collaborationBranch: gitRepoCollaborationBranch
54-
hostName: gitRepoHostName
55-
lastCommitId: gitRepoLastCommitId
56-
projectName: gitRepoVstsProjectName
57-
repositoryName: gitRepoRepositoryName
58-
rootFolder: gitRepoRootFolder
59-
tenantId: gitRepoVstsTenantId
60-
type: gitRepoType
61-
}
62-
}
86+
properties: selectedSynapseProperties
6387
}
6488

6589
resource synapseWorkspaceFwRules 'Microsoft.Synapse/workspaces/firewallRules@2021-06-01' = {

deploy/install.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,22 @@ envCode=${envCode:-"${1}"}
2222
location=${location:-"${2}"}
2323
envTag=${envTag:-"synapse-${envCode}"}
2424
deploymentName=${3:-"${envTag}-deploy"}
25+
securityEnabled=${securityEnabled:-false}
26+
preventDataExfiltration=${preventDataExfiltration:-false}
2527

2628
DEPLOYMENT_SCRIPT="az deployment sub create -l $location -n $deploymentName \
2729
-f ./deploy/infra/main.bicep \
2830
-p \
2931
location=$location \
3032
environmentCode=$envCode \
31-
environment=$envTag"
33+
environment=$envTag \
34+
securityEnabled=$securityEnabled \
35+
preventDataExfiltration=$preventDataExfiltration"
3236
$DEPLOYMENT_SCRIPT
33-
set +x
3437

38+
if [[ $securityEnabled ]]
39+
then
40+
./deploy/enableSecurityFeatures.sh $envCode
41+
fi
42+
43+
set +x

0 commit comments

Comments
 (0)