Skip to content

Commit 2dd4746

Browse files
committed
git rebase and setup.sh changes to pass securityEnabled parameters to bicep
1 parent e0335ed commit 2dd4746

File tree

5 files changed

+70
-21
lines changed

5 files changed

+70
-21
lines changed

deploy/README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ Steps 2 through 4 can instead be deployed using a single script below:
4848
./deploy/setup.sh <environmentCode> <location> <pipelineName> <envTag>
4949

5050
```
51+
To enabled security features like Synapse managed VNET, managed private endpoints, and privates enpoints to 3 synapse endpoints, set 'SECURITY_ENABLED=true' when running setup.sh:
52+
```
53+
SECURITY_ENABLED=true ./deploy/setup.sh <environmentCode> <location> <pipelineName> <envTag>
54+
```
55+
**Note that if you turn on SECURITY_ENABLED during setup, Synapse endpoints are restricted to the custom VNET in the deployment environment. Thus, you need to create a Windows jumpbox inside the VNET to connect to Synapse Studio.**
56+
5157
If you like to package other pipelines or re-package an updated/modified pipeline, follow the instructions under `Packaging the Synapse pipeline` section. The script mentioned in that section can be rerun multiple times.
5258

5359
Arguments | Required | Sample value
@@ -83,6 +89,12 @@ To install infrastructure execute install.sh script as follows
8389

8490
```
8591

92+
To enabled security features like Synapse managed VNET, managed private endpoints, and privates enpoints to 3 synapse endpoints, set 'SECURITY_ENABLED=true' when running install.sh:
93+
```
94+
SECURITY_ENABLED=true ./deploy/install.sh <environmentCode> <location> <envTag>
95+
```
96+
**Note that if you turn on SECURITY_ENABLED during setup, Synapse endpoints are restricted to the custom VNET in the deployment environment. Thus, you need to create a Windows jumpbox inside the VNET to connect to Synapse Studio.**
97+
8698
Default values for the parameters are provided in the script itself.
8799

88100
Arguments | Required | Sample value
@@ -113,6 +125,11 @@ For eg.
113125
az deployment sub create -l <region> -n aoi -f main.bicep -p location=<region> environmentCode=aoi environment=synapse-aoi
114126
```
115127

128+
To enabled security features like Synapse managed VNET, managed private endpoints, and privates enpoints to 3 Synapse endpoints, pass parameter 'securityEnabled=true' when running bicep:
129+
```
130+
bash
131+
az deployment sub create -l <region_name> -n <deployment_name> -f main.bicep -p location=<region_name> environmentCode=<environment_name_prefix> environment=<tag_value> securityEnabled=true
132+
```
116133

117134
## Configuring the Resources
118135

@@ -142,7 +159,10 @@ Once the above step completes, a zip file is generated. Upload the generated zip
142159
4. When prompted to select a file, pick the zip file generated in the previous step
143160
5. Pipelines and its dependencies are imported to the Synapse Studio. Validate the components being imported for any errors
144161
6. Click "Publish all" and wait for the imported components to be published
145-
NOTE: You may run into this error during import "Invalid template, please check the template file". It is a known issue that we are working on with the product team. In the interim, we suggest importing from Git Repository as described below.
162+
NOTE: You may run into this error during import "Invalid template, please check the template file". It is a known issue that we are working on with the product team. In the interim, we suggest importing from Git Repository as described below.
163+
164+
**Note that if you turn on SECURITY_ENABLED during setup, Synapse endpoints are restricted to the custom VNET in the deployment environment. Thus, you need to create a Windows jumpbox inside the VNET to connect to Synapse Studio and import the package.**
165+
146166
## Importing from Git Repository
147167

148168
Another way to get import pipeline into the Synape Studio is through Source Control repository like GitHub or Azure DevOps repository. Refer to the document on [Source Control](https://docs.microsoft.com/azure/synapse-analytics/cicd/source-control) to learn about Git Integration for Azure Synapse Analytics and how to setup.

deploy/addManagedPE.sh

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@ if [[ -z "$1" ]]
1010
exit 1
1111
fi
1212
ENVCODE=$1
13+
PE_APPROVAL_DESCRIPTION="Approved by script"
14+
15+
approved_managed_private_endpoint_request_exists() {
16+
local groupId=$1
17+
local resourceName=$2
18+
local resourceType=$3
19+
20+
local peList=$(az network private-endpoint-connection list \
21+
-g $groupId -n $resourceName --type $resourceType -ojson 2>/dev/null || echo '')
22+
local result=''
23+
24+
if [[ -n peList ]];
25+
then
26+
result=$( echo $peList \
27+
| jq -r ".[] | select (.properties.privateLinkServiceConnectionState.description == \"${PE_APPROVAL_DESCRIPTION}\").id" )
28+
echo $result
29+
fi
30+
echo $result
31+
}
1332

1433
create_synapase_managed_private_endpoint() {
1534
local tmpfile=$(mktemp)
@@ -63,7 +82,7 @@ approve_synapase_managed_private_endpoint() {
6382
if [[ $PE_CONNECTION_APPROVAL_STATUS != "Approved" ]];
6483
then
6584
az network private-endpoint-connection approve \
66-
--id $PE_CONNECTION_ID --description "Approved by script"
85+
--id $PE_CONNECTION_ID --description "$PE_APPROVAL_DESCRIPTION"
6786
echo "$PE_CONNECTION_ID got approved"
6887
fi
6988
fi
@@ -76,7 +95,11 @@ do
7695
sleep 30
7796
SYNAPSE_STORAGE_ACCT=$(az storage account list --query "[?tags.store && tags.store == 'synapse'].name" -o tsv -g $ENVCODE-pipeline-rg)
7897
done
79-
approve_synapase_managed_private_endpoint $ENVCODE-pipeline-rg $SYNAPSE_STORAGE_ACCT "Microsoft.Storage/storageAccounts"
98+
result=$(approved_managed_private_endpoint_request_exists $ENVCODE-pipeline-rg $SYNAPSE_STORAGE_ACCT "Microsoft.Storage/storageAccounts")
99+
if [[ -z $result ]];
100+
then
101+
approve_synapase_managed_private_endpoint $ENVCODE-pipeline-rg $SYNAPSE_STORAGE_ACCT "Microsoft.Storage/storageAccounts"
102+
fi
80103

81104
# Create Managed Private Endpoints (PE) if not exist
82105
PIPELINE_KV=$(az keyvault list --query "[?tags.usage && tags.usage == 'linkedService']" -ojson -g $ENVCODE-pipeline-rg)
@@ -87,7 +110,12 @@ do
87110
done
88111
PIPELINE_KV_NAME=$(echo $PIPELINE_KV | jq -r '.[0].name')
89112
PIPELINE_KV_ID=$(echo $PIPELINE_KV | jq -r '.[0].id')
90-
create_synapase_managed_private_endpoint "$ENVCODE-pipeline-syn-ws" "$ENVCODE-mpe-pipeline-kv" "vault" "$PIPELINE_KV_ID"
113+
result=$(approved_managed_private_endpoint_request_exists $ENVCODE-pipeline-rg $PIPELINE_KV_NAME "Microsoft.Keyvault/vaults")
114+
if [[ -z $result ]]
115+
then
116+
create_synapase_managed_private_endpoint "$ENVCODE-pipeline-syn-ws" "$ENVCODE-mpe-pipeline-kv" "vault" "$PIPELINE_KV_ID"
117+
approve_synapase_managed_private_endpoint $ENVCODE-pipeline-rg $PIPELINE_KV_NAME "Microsoft.Keyvault/vaults"
118+
fi
91119

92120
DATA_STORAGE_ACCT=$(az storage account list --query "[?tags.store && tags.store == 'raw']" -ojson -g $ENVCODE-data-rg)
93121
while [[ $DATA_STORAGE_ACCT == '[]' ]]
@@ -97,7 +125,12 @@ do
97125
done
98126
DATA_STORAGE_ACCT_NAME=$(echo $DATA_STORAGE_ACCT | jq -r '.[0].name')
99127
DATA_STORAGE_ACCT_ID=$(echo $DATA_STORAGE_ACCT | jq -r '.[0].id')
100-
create_synapase_managed_private_endpoint "$ENVCODE-pipeline-syn-ws" "$ENVCODE-mpe-data-raw" "dfs" "$DATA_STORAGE_ACCT_ID"
128+
result=$(approved_managed_private_endpoint_request_exists $ENVCODE-data-rg $DATA_STORAGE_ACCT_NAME "Microsoft.Storage/storageAccounts")
129+
if [[ -z $result ]]
130+
then
131+
create_synapase_managed_private_endpoint "$ENVCODE-pipeline-syn-ws" "$ENVCODE-mpe-data-raw" "dfs" "$DATA_STORAGE_ACCT_ID"
132+
approve_synapase_managed_private_endpoint $ENVCODE-data-rg $DATA_STORAGE_ACCT_NAME "Microsoft.Storage/storageAccounts"
133+
fi
101134

102135
DATA_KV=$(az keyvault list --query "[?tags.usage && tags.usage == 'general']" -ojson -g $ENVCODE-data-rg)
103136
while [[ $DATA_KV == '[]' ]];
@@ -107,10 +140,9 @@ do
107140
done
108141
DATA_KV_NAME=$(echo $DATA_KV | jq -r '.[0].name')
109142
DATA_KV_ID=$(echo $DATA_KV | jq -r '.[0].id')
110-
create_synapase_managed_private_endpoint "$ENVCODE-pipeline-syn-ws" "$ENVCODE-mpe-data-kv" "vault" "$DATA_KV_ID"
111-
112-
113-
# Approve remaining Managed Private Endpoints (PE)
114-
approve_synapase_managed_private_endpoint $ENVCODE-pipeline-rg $PIPELINE_KV_NAME "Microsoft.Keyvault/vaults"
115-
approve_synapase_managed_private_endpoint $ENVCODE-data-rg $DATA_STORAGE_ACCT_NAME "Microsoft.Storage/storageAccounts"
116-
approve_synapase_managed_private_endpoint $ENVCODE-data-rg $DATA_KV_NAME "Microsoft.Keyvault/vaults"
143+
result=$(approved_managed_private_endpoint_request_exists $ENVCODE-data-rg $DATA_KV_NAME "Microsoft.Keyvault/vaults")
144+
if [[ -z $result ]]
145+
then
146+
create_synapase_managed_private_endpoint "$ENVCODE-pipeline-syn-ws" "$ENVCODE-mpe-data-kv" "vault" "$DATA_KV_ID"
147+
approve_synapase_managed_private_endpoint $ENVCODE-data-rg $DATA_KV_NAME "Microsoft.Keyvault/vaults"
148+
fi

deploy/infra/security-addons.bicep

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ module addSynapseSqlOnDemandPrivateEndpoint 'modules/privateendpoints.bicep' = {
9191
]
9292
}
9393

94-
output customVnetId string = customVnet.id
95-
output customVnetName string = customVnet.name
96-
output pipelineSubnetId string = pipelineSubnet.id
97-
output pipelineSubnetName string = pipelineSubnet.name
98-
output synapseWorkspaceProperties object = synapseWorkspace.properties
9994

10095

10196

deploy/install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ 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}
25+
SECURITY_ENABLED=${SECURITY_ENABLED:-false}
26+
PREVENT_DATA_EXFILTRATION=${PREVENT_DATA_EXFILTRATION:-false}
2727

2828
DEPLOYMENT_SCRIPT="az deployment sub create -l $location -n $deploymentName \
2929
-f ./deploy/infra/main.bicep \
3030
-p \
3131
location=$location \
3232
environmentCode=$envCode \
3333
environment=$envTag \
34-
securityEnabled=$securityEnabled \
35-
preventDataExfiltration=$preventDataExfiltration"
34+
securityEnabled=$SECURITY_ENABLED \
35+
preventDataExfiltration=$PREVENT_DATA_EXFILTRATION"
3636
$DEPLOYMENT_SCRIPT
3737

3838
if [[ $securityEnabled ]]

deploy/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ LOCATION=$2
88
PIPELINE_NAME=$3
99
ENVTAG=$4
1010

11+
export SECURITY_ENABLED=${SECURITY_ENABLED:-false}
12+
export PREVENT_DATA_EXFILTRATION=${PREVENT_DATA_EXFILTRATION:-false}
1113

1214
set -x
1315

0 commit comments

Comments
 (0)