And update API versions. I couldn't find live tests pipelines for it.
This commit is contained in:
Deyaaeldeen Almahallawi 2024-08-22 20:57:51 -07:00 коммит произвёл GitHub
Родитель a12071e899
Коммит 994d08c49e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 166 добавлений и 407 удалений

Просмотреть файл

@ -0,0 +1,166 @@
param baseName string = resourceGroup().name
param testApplicationOid string
param workspacePrefix string = 'workspace'
param location string = resourceGroup().location
param defaultDataLakeStorageAccountNamePrefix string = 'storage'
param defaultDataLakeStorageFilesystemNamePrefix string = 'filesystem'
param sqlAdministratorLogin string = 'sqladminuser'
@description('The password must be atleast 8 characters long and contain characters from three of the following four categories: (uppercase letters, lowercase letters, digits (0-9), Non-alphanumeric characters such as: !, $, #, or %)')
@minLength(8)
@secure()
param sqlAdministratorLoginPassword string
param setWorkspaceIdentityRbacOnStorageAccount bool = false
param allowAllConnections bool = true
param grantWorkspaceIdentityControlForSql string = 'Enabled' // Allowed values: 'Enabled', 'Disabled'
param managedVirtualNetwork string = 'default' // Allowed values: 'default', ''
param tagValues object = {}
param storageLocation string = resourceGroup().location
param isNewStorageAccount bool = true
param isNewFileSystemOnly bool = false
param storageAccessTier string = 'Hot'
param storageAccountType string = 'Standard_RAGRS'
param storageSupportsHttpsTrafficOnly bool = true
param storageKind string = 'StorageV2'
param storageIsHnsEnabled bool = true
param setSbdcRbacOnStorageAccount bool = false
param sparkPoolPrefix string = 'spark'
param tags object = {}
param autoScaleEnabled bool = true
param autoScaleMinNodeCount int = 3
param autoScaleMaxNodeCount int = 40
param nodeCount int = 3
param nodeSizeFamily string = 'MemoryOptimized'
param nodeSize string = 'Small'
param autoPauseEnabled bool = true
param autoPauseDelayInMinutes int = 15
param sparkVersion string = '2.4'
param libraryRequirementsFilename string = ''
param libraryRequirementsContent string = ''
param managedVirtualNetworkSettings object = {
allowedAadTenantIdsForLinking: []
preventDataExfiltration: false
}
var storageEndpointSuffix = environment().suffixes.storage
var uniqueWorkspaceName = '${workspacePrefix}${baseName}'
var uniqueDataLakeStorageAccountName = '${defaultDataLakeStorageAccountNamePrefix}${baseName}'
var uniqueDataLakeStorageFilesystemName = '${defaultDataLakeStorageFilesystemNamePrefix}${baseName}'
var storageBlobDataContributorRoleID = 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
var defaultDataLakeStorageAccountUrl = 'https://${uniqueDataLakeStorageAccountName}.dfs.${storageEndpointSuffix}'
var uniqueSparkPoolName = take('${sparkPoolPrefix}${baseName}', 15)
resource synapseWorkspace 'Microsoft.Synapse/workspaces@2021-06-01' = {
name: uniqueWorkspaceName
location: location
tags: tagValues
identity: {
type: 'SystemAssigned'
}
properties: {
defaultDataLakeStorage: {
accountUrl: defaultDataLakeStorageAccountUrl
filesystem: uniqueDataLakeStorageFilesystemName
}
sqlAdministratorLogin: sqlAdministratorLogin
sqlAdministratorLoginPassword: sqlAdministratorLoginPassword
managedVirtualNetwork: managedVirtualNetwork
managedVirtualNetworkSettings: managedVirtualNetworkSettings
}
dependsOn: [
storageAccount
]
resource firewallRules 'firewallRules@2021-06-01' = if (allowAllConnections) {
name: 'allowAll'
properties: {
startIpAddress: '0.0.0.0'
endIpAddress: '255.255.255.255'
}
}
resource managedIdentitySqlControlSettings 'managedIdentitySqlControlSettings@2021-06-01' = {
name: 'default'
properties: {
grantSqlControlToManagedIdentity: {
desiredState: grantWorkspaceIdentityControlForSql
}
}
}
}
resource roleAssignmentForSynapse 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (setWorkspaceIdentityRbacOnStorageAccount) {
name: guid(resourceGroup().id, storageBlobDataContributorRoleID, uniqueWorkspaceName)
properties: {
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageBlobDataContributorRoleID)
principalId: synapseWorkspace.identity.principalId
principalType: 'ServicePrincipal'
}
scope: storageAccount
}
resource roleAssignmentForTestApp 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (setWorkspaceIdentityRbacOnStorageAccount && setSbdcRbacOnStorageAccount) {
name: guid(resourceGroup().id, storageBlobDataContributorRoleID, testApplicationOid)
properties: {
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageBlobDataContributorRoleID)
principalId: testApplicationOid
principalType: 'App'
}
scope: storageAccount
}
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = if (isNewStorageAccount) {
name: uniqueDataLakeStorageAccountName
location: storageLocation
sku: {
name: storageAccountType
}
kind: storageKind
properties: {
accessTier: storageAccessTier
supportsHttpsTrafficOnly: storageSupportsHttpsTrafficOnly
isHnsEnabled: storageIsHnsEnabled
}
}
resource storageFilesystem 'Microsoft.Storage/storageAccounts/blobServices/containers@2023-05-01' = if (!isNewFileSystemOnly) {
name: '${uniqueDataLakeStorageAccountName}/default/${uniqueDataLakeStorageFilesystemName}'
properties: {
publicAccess: 'None'
}
dependsOn: [
storageAccount
]
}
resource bigDataPool 'Microsoft.Synapse/workspaces/bigDataPools@2021-06-01' = {
name: uniqueSparkPoolName
location: location
tags: tags
properties: {
nodeCount: nodeCount
nodeSizeFamily: nodeSizeFamily
nodeSize: nodeSize
autoScale: {
enabled: autoScaleEnabled
minNodeCount: autoScaleMinNodeCount
maxNodeCount: autoScaleMaxNodeCount
}
autoPause: {
enabled: autoPauseEnabled
delayInMinutes: autoPauseDelayInMinutes
}
sparkVersion: sparkVersion
libraryRequirements: {
filename: libraryRequirementsFilename
content: libraryRequirementsContent
}
}
parent: synapseWorkspace
}
output AZURE_SYNAPSE_WORKSPACE_URL string = 'https://${uniqueWorkspaceName}.dev.azuresynapse.net'
output AZURE_SYNAPSE_WORKSPACE_NAME string = uniqueWorkspaceName
output AZURE_SYNAPSE_SPARK_POOL_NAME string = uniqueSparkPoolName
output AZURE_STORAGE_ACCOUNT_NAME string = uniqueDataLakeStorageAccountName
output AZURE_STORAGE_FILE_SYSTEM_NAME string = uniqueDataLakeStorageFilesystemName
output AZURE_SYNAPSE_PRINCIPAL_ID string = testApplicationOid

Просмотреть файл

@ -1,407 +0,0 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"baseName": {
"type": "string",
"defaultValue": "[resourceGroup().name]",
"metadata": {
"description": "The base resource name."
}
},
"testApplicationOid": {
"type": "string",
"metadata": {
"description": "The principal to assign the role to. This is application object id."
}
},
"workspacePrefix": {
"type": "String",
"defaultValue": "workspace"
},
"location": {
"type": "String",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "The location of the resource. By default, this is the same as the resource group."
}
},
"defaultDataLakeStorageAccountNamePrefix": {
"type": "String",
"defaultValue": "storage"
},
"defaultDataLakeStorageFilesystemNamePrefix": {
"type": "String",
"defaultValue": "filesystem"
},
"sqlAdministratorLogin": {
"type": "String",
"defaultValue": "sqladminuser"
},
"sqlAdministratorLoginPassword": {
"defaultValue": "",
"type": "SecureString"
},
"setWorkspaceIdentityRbacOnStorageAccount": {
"type": "Bool",
"defaultValue": false
},
"allowAllConnections": {
"defaultValue": true,
"type": "Bool"
},
"grantWorkspaceIdentityControlForSql": {
"allowedValues": [
"Enabled",
"Disabled"
],
"type": "String",
"defaultValue": "Enabled"
},
"managedVirtualNetwork": {
"allowedValues": [
"default",
""
],
"type": "String",
"defaultValue": "default"
},
"tagValues": {
"defaultValue": {},
"type": "Object"
},
"storageSubscriptionID": {
"defaultValue": "[subscription().subscriptionId]",
"type": "String"
},
"storageResourceGroupName": {
"defaultValue": "[resourceGroup().name]",
"type": "String"
},
"storageLocation": {
"defaultValue": "[resourceGroup().location]",
"type": "String"
},
"storageRoleUniqueId": {
"defaultValue": "[newGuid()]",
"type": "String"
},
"isNewStorageAccount": {
"defaultValue": true,
"type": "Bool"
},
"isNewFileSystemOnly": {
"defaultValue": false,
"type": "Bool"
},
"adlaResourceId": {
"defaultValue": "",
"type": "String"
},
"storageAccessTier": {
"type": "String",
"defaultValue": "Hot"
},
"storageAccountType": {
"type": "String",
"defaultValue": "Standard_RAGRS"
},
"storageSupportsHttpsTrafficOnly": {
"type": "Bool",
"defaultValue": true
},
"storageKind": {
"type": "String",
"defaultValue": "StorageV2"
},
"storageIsHnsEnabled": {
"type": "Bool",
"defaultValue": true
},
"setSbdcRbacOnStorageAccount": {
"defaultValue": false,
"type": "Bool"
},
"sparkPoolPrefix": {
"type": "String",
"defaultValue": "spark"
},
"tags": {
"defaultValue": {},
"type": "Object"
},
"autoScaleEnabled": {
"type": "Bool",
"defaultValue": true
},
"autoScaleMinNodeCount": {
"defaultValue": 3,
"type": "Int"
},
"autoScaleMaxNodeCount": {
"defaultValue": 40,
"type": "Int"
},
"nodeCount": {
"defaultValue": 3,
"type": "Int"
},
"nodeSizeFamily": {
"type": "String",
"defaultValue": "MemoryOptimized"
},
"nodeSize": {
"type": "String",
"defaultValue": "Small"
},
"autoPauseEnabled": {
"type": "Bool",
"defaultValue": true
},
"autoPauseDelayInMinutes": {
"defaultValue": 15,
"type": "Int"
},
"sparkVersion": {
"type": "String",
"defaultValue": "2.4"
},
"libraryRequirementsFilename": {
"defaultValue": "",
"type": "String"
},
"libraryRequirementsContent": {
"defaultValue": "",
"type": "String"
},
"managedVirtualNetworkSettings": {
"type": "object",
"defaultValue": {
"allowedAadTenantIdsForLinking": [],
"preventDataExfiltration": false
}
}
},
"variables": {
"uniqueWorkspaceName": "[concat(parameters('workspacePrefix'), parameters('baseName'))]",
"uniqueDataLakeStorageAccountName": "[concat(parameters('defaultDataLakeStorageAccountNamePrefix'), parameters('baseName'))]",
"uniqueDataLakeStorageFilesystemName": "[concat(parameters('defaultDataLakeStorageFilesystemNamePrefix'), parameters('baseName'))]",
"storageBlobDataContributorRoleID": "ba92f5b4-2d11-453d-a403-e96b0029c9fe",
"defaultDataLakeStorageAccountUrl": "[concat('https://', variables('uniqueDataLakeStorageAccountName'), '.dfs.core.windows.net')]",
"uniqueSparkPoolName": "[take(concat(parameters('sparkPoolPrefix'), parameters('baseName')), 15)]"
},
"resources": [
{
"type": "Microsoft.Synapse/workspaces",
"apiVersion": "2019-06-01-preview",
"name": "[variables('uniqueWorkspaceName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueDataLakeStorageAccountName'))]",
"[concat('Microsoft.Resources/deployments/', variables('uniqueDataLakeStorageFilesystemName'))]"
],
"tags": "[parameters('tagValues')]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"defaultDataLakeStorage": {
"accountUrl": "[variables('defaultDataLakeStorageAccountUrl')]",
"filesystem": "[variables('uniqueDataLakeStorageFilesystemName')]"
},
"sqlAdministratorLogin": "[parameters('sqlAdministratorLogin')]",
"sqlAdministratorLoginPassword": "[parameters('sqlAdministratorLoginPassword')]",
"adlaResourceId": "[parameters('adlaResourceId')]",
"managedVirtualNetwork": "[parameters('managedVirtualNetwork')]",
"managedVirtualNetworkSettings": "[parameters('managedVirtualNetworkSettings')]"
},
"resources": [
{
"type": "firewallrules",
"apiVersion": "2019-06-01-preview",
"name": "allowAll",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Synapse/workspaces/', variables('uniqueWorkspaceName'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "255.255.255.255"
},
"condition": "[parameters('allowAllConnections')]"
},
{
"type": "managedIdentitySqlControlSettings",
"apiVersion": "2019-06-01-preview",
"name": "default",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Synapse/workspaces/', variables('uniqueWorkspaceName'))]"
],
"properties": {
"grantSqlControlToManagedIdentity": {
"desiredState": "[parameters('grantWorkspaceIdentityControlForSql')]"
}
}
}
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2019-05-01",
"name": "storageRoleDeploymentResource",
"dependsOn": [
"[concat('Microsoft.Synapse/workspaces/', variables('uniqueWorkspaceName'))]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts/providers/roleAssignments",
"apiVersion": "2018-09-01-preview",
"name": "[concat(variables('uniqueDataLakeStorageAccountName'), '/Microsoft.Authorization/', guid(concat(resourceGroup().id, '/', variables('storageBlobDataContributorRoleID'), '/', variables('uniqueWorkspaceName'), '/', parameters('storageRoleUniqueId'))))]",
"location": "[parameters('storageLocation')]",
"properties": {
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('storageBlobDataContributorRoleID'))]",
"principalId": "[reference(concat('Microsoft.Synapse/workspaces/', variables('uniqueWorkspaceName')), '2019-06-01-preview', 'Full').identity.principalId]",
"principalType": "ServicePrincipal"
}
},
{
"condition": "[parameters('setSbdcRbacOnStorageAccount')]",
"type": "Microsoft.Storage/storageAccounts/providers/roleAssignments",
"apiVersion": "2018-09-01-preview",
"name": "[concat(variables('uniqueDataLakeStorageAccountName'), '/Microsoft.Authorization/', guid(concat(resourceGroup().id, '/', variables('storageBlobDataContributorRoleID'), '/', parameters('testApplicationOid'), '/', parameters('storageRoleUniqueId'))))]",
"properties": {
"roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('storageBlobDataContributorRoleID'))]",
"principalId": "[parameters('testApplicationOid')]",
"principalType": "App"
}
}
]
}
},
"subscriptionId": "[parameters('storageSubscriptionID')]",
"resourceGroup": "[parameters('storageResourceGroupName')]",
"condition": "[parameters('setWorkspaceIdentityRbacOnStorageAccount')]"
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-02-01",
"name": "[variables('uniqueDataLakeStorageAccountName')]",
"location": "[parameters('storageLocation')]",
"tags": {},
"sku": {
"name": "[parameters('storageAccountType')]"
},
"kind": "[parameters('storageKind')]",
"properties": {
"accessTier": "[parameters('storageAccessTier')]",
"supportsHttpsTrafficOnly": "[parameters('storageSupportsHttpsTrafficOnly')]",
"isHnsEnabled": "[parameters('storageIsHnsEnabled')]"
},
"resources": [
{
"type": "blobServices/containers",
"apiVersion": "2018-02-01",
"name": "[concat('default/', variables('uniqueDataLakeStorageFilesystemName'))]",
"dependsOn": [
"[concat('Microsoft.Storage/storageAccounts/', variables('uniqueDataLakeStorageAccountName'))]"
],
"properties": {
"publicAccess": "None"
},
"condition": "[parameters('isNewStorageAccount')]"
}
],
"condition": "[parameters('isNewStorageAccount')]"
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2019-05-01",
"name": "[variables('uniqueDataLakeStorageFilesystemName')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"name": "[concat(variables('uniqueDataLakeStorageAccountName'), '/default/', variables('uniqueDataLakeStorageFilesystemName'))]",
"apiVersion": "2018-02-01",
"properties": {
"publicAccess": "None"
}
}
]
}
},
"subscriptionId": "[parameters('storageSubscriptionID')]",
"resourceGroup": "[parameters('storageResourceGroupName')]",
"condition": "[parameters('isNewFileSystemOnly')]"
},
{
"type": "Microsoft.Synapse/workspaces/bigDataPools",
"apiVersion": "2019-06-01-preview",
"name": "[concat(variables('uniqueWorkspaceName'), '/', variables('uniqueSparkPoolName'))]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Synapse/workspaces/', variables('uniqueWorkspaceName'))]"
],
"tags": "[parameters('tags')]",
"properties": {
"nodeCount": "[parameters('nodeCount')]",
"nodeSizeFamily": "[parameters('nodeSizeFamily')]",
"nodeSize": "[parameters('nodeSize')]",
"autoScale": {
"enabled": "[parameters('autoScaleEnabled')]",
"minNodeCount": "[parameters('autoScaleMinNodeCount')]",
"maxNodeCount": "[parameters('autoScaleMaxNodeCount')]"
},
"autoPause": {
"enabled": "[parameters('autoPauseEnabled')]",
"delayInMinutes": "[parameters('autoPauseDelayInMinutes')]"
},
"sparkVersion": "[parameters('sparkVersion')]",
"libraryRequirements": {
"filename": "[parameters('libraryRequirementsFilename')]",
"content": "[parameters('libraryRequirementsContent')]"
}
}
}
],
"outputs": {
"AZURE_SYNAPSE_WORKSPACE_URL": {
"type": "string",
"value": "[concat('https://', variables('uniqueWorkspaceName'), '.dev.azuresynapse.net')]"
},
"AZURE_SYNAPSE_WORKSPACE_NAME": {
"type": "string",
"value": "[variables('uniqueWorkspaceName')]"
},
"AZURE_SYNAPSE_SPARK_POOL_NAME": {
"type": "string",
"value": "[variables('uniqueSparkPoolName')]"
},
"AZURE_STORAGE_ACCOUNT_NAME": {
"type": "string",
"value": "[variables('uniqueDataLakeStorageAccountName')]"
},
"AZURE_STORAGE_FILE_SYSTEM_NAME": {
"type": "string",
"value": "[variables('uniqueDataLakeStorageFilesystemName')]"
},
"AZURE_SYNAPSE_PRINCIPAL_ID": {
"type": "string",
"value": "[parameters('testApplicationOid')]"
}
}
}