forked from Azure/azure-quickstart-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azuredeploy.json
264 lines (264 loc) · 8.55 KB
/
azuredeploy.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "Name of the Azure storage account that contains the data to be copied."
}
},
"storageAccountKey": {
"type": "securestring",
"metadata": {
"description": "Key for the Azure storage account."
}
},
"sourceBlobContainer": {
"type": "string",
"metadata": {
"description": "Name of the blob container in the Azure Storage account."
}
},
"sourceBlobName": {
"type": "string",
"metadata": {
"description": "Name of the blob in the container that has the data to be copied to Azure SQL Database table"
}
},
"sqlServerName": {
"type": "string",
"metadata": {
"description": "Name of the Azure SQL Server that will hold the output/copied data."
}
},
"sqlDatabaseName": {
"type": "string",
"metadata": {
"description": "Name of Azure SQL Database in Azure SQL server copying data to."
}
},
"sqlUserID": {
"type": "string",
"metadata": {
"description": "Username for access to Azure SQL Server."
}
},
"sqlPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the user to Azure SQL Server."
}
},
"sqlTargetTable": {
"type": "string",
"metadata": {
"description": "Table in the Azure SQL Database that will hold the copied data."
}
},
"sqlWriterTableType": {
"type": "string",
"metadata": {
"description": "Specify a table type name to be used in the stored procedure. Copy activity makes the data being moved available in a temp table with this table type."
}
},
"sqlWriterStoredProcedureName": {
"type": "string",
"metadata": {
"description": "Name of the stored procedure that upserts (updates/inserts) data into the target table."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"dataFactoryName": "[concat('CopyFromAzureBlobToAzureSQLDbSproc', uniqueString(resourceGroup().id))]",
"storageLinkedServiceName": "StorageLinkedService",
"sqlLinkedServiceName": "SqlLinkedService",
"storageDataset": "StorageDataset",
"intermediateDataset": "IntermediateDataset",
"sqlDataset": "SqlDataset",
"pipelineName": "BlobtoSqlDbCopyPipelineSproc"
},
"resources": [
{
"name": "[variables('dataFactoryName')]",
"apiVersion": "2015-10-01",
"type": "Microsoft.DataFactory/datafactories",
"location": "[parameters('location')]",
"resources": [
{
"type": "linkedservices",
"name": "[variables('storageLinkedServiceName')]",
"apiVersion": "2015-10-01",
"dependsOn": [
"[variables('dataFactoryName')]"
],
"properties": {
"type": "AzureStorage",
"description": "Azure Storage Linked Service",
"typeProperties": {
"connectionString": "[concat('DefaultEndpointsProtocol=https;AccountName=',parameters('storageAccountName'),';AccountKey=',parameters('storageAccountKey'))]"
}
}
},
{
"type": "linkedservices",
"name": "[variables('sqlLinkedServiceName')]",
"apiVersion": "2015-10-01",
"dependsOn": [
"[variables('dataFactoryName')]"
],
"properties": {
"type": "AzureSqlDatabase",
"description": "Azure SQL linked service",
"typeProperties": {
"connectionString": "[concat('Data Source=tcp:', parameters('sqlServerName'), '.database.windows.net,1433;Initial Catalog=', parameters('sqlDatabaseName'), ';Integrated Security=False;User ID=', parameters('sqlUserId'), ';Password=', parameters('sqlPassword'), ';Connect Timeout=30;Encrypt=True')]"
}
}
},
{
"type": "datasets",
"name": "[variables('storageDataset')]",
"dependsOn": [
"[variables('dataFactoryName')]",
"[variables('storageLinkedServiceName')]"
],
"apiVersion": "2015-10-01",
"properties": {
"type": "AzureBlob",
"linkedServiceName": "[variables('storageLinkedServiceName')]",
"typeProperties": {
"folderPath": "[concat(parameters('sourceBlobContainer'), '/')]",
"fileName": "[parameters('sourceBlobName')]",
"format": {
"type": "TextFormat"
}
},
"availability": {
"frequency": "Hour",
"interval": 1
},
"external": true
}
},
{
"type": "datasets",
"name": "[variables('intermediateDataset')]",
"dependsOn": [
"[variables('dataFactoryName')]",
"[variables('sqlLinkedServiceName')]"
],
"apiVersion": "2015-10-01",
"properties": {
"type": "AzureSqlTable",
"linkedServiceName": "[variables('sqlLinkedServiceName')]",
"typeProperties": {
"tableName": "[variables('intermediateDataset')]"
},
"availability": {
"frequency": "Hour",
"interval": 1
}
}
},
{
"type": "datasets",
"name": "[variables('sqlDataset')]",
"dependsOn": [
"[variables('dataFactoryName')]",
"[variables('sqlLinkedServiceName')]"
],
"apiVersion": "2015-10-01",
"properties": {
"type": "AzureSqlTable",
"linkedServiceName": "[variables('sqlLinkedServiceName')]",
"typeProperties": {
"tableName": "[parameters('sqlTargetTable')]"
},
"availability": {
"frequency": "Hour",
"interval": 1
}
}
},
{
"type": "dataPipelines",
"name": "[variables('pipelineName')]",
"dependsOn": [
"[variables('dataFactoryName')]",
"[variables('storageLinkedServiceName')]",
"[variables('sqlLinkedServiceName')]",
"[variables('storageDataset')]",
"[variables('sqlDataset')]"
],
"apiVersion": "2015-10-01",
"properties": {
"description": "Copies data from Azure Blob to Sql DB while invoking stored procedure",
"activities": [
{
"name": "BlobtoSqlTableCopyActivity",
"type": "Copy",
"typeProperties": {
"source": {
"type": "BlobSource"
},
"sink": {
"type": "SqlSink",
"writeBatchSize": 0,
"writeBatchTimeout": "00:00:00"
}
},
"inputs": [
{
"name": "[variables('storageDataset')]"
}
],
"outputs": [
{
"name": "[variables('intermediateDataset')]"
}
]
},
{
"name": "SqlTabletoSqlDbSprocActivity",
"type": "SqlServerStoredProcedure",
"inputs": [
{
"name": "[variables('intermediateDataset')]"
}
],
"outputs": [
{
"name": "[variables('sqlDataset')]"
}
],
"typeProperties": {
"storedProcedureName": "[parameters('sqlWriterStoredProcedureName')]"
},
"scheduler": {
"frequency": "Hour",
"interval": 1
},
"policy": {
"timeout": "02:00:00",
"concurrency": 1,
"executionPriorityOrder": "NewestFirst",
"retry": 3
}
}
],
"start": "2016-10-01T00:00:00Z",
"end": "2016-10-02T00:00:00Z"
}
}
]
}
],
"outputs": {}
}