Search code examples
azureazure-synapseazure-bicep

Unable to create synapse workspace sql bool using bicep getting error (Code: CreateSqlComputeOrchestrationError;OperationInterrupted)


Attempting to create a synapse workspace and sql pool using bicep. Getting the error message below.

SQL Datawarehouse 'sql_pool_1' creation for workspace synapseyjdzc2vokh in subscription xxxxx did not succeed The operation on the resource could not be completed because it was interrupted by another operation on the same resource. (Code: CreateSqlComputeOrchestrationError;OperationInterrupted)

I have tried several things and made a number of changes, without little information on the error I am finding it difficult to ascertain the root cause of the error.

Main.bicep file.

//scope
targetScope = 'resourceGroup'
param utcValue string = utcNow()
var randomstring = toLower(replace(uniqueString(subscription().id, resourceGroup().id, utcValue), '-', ''))
param ipaddress string
var synapseName = 'synapse${randomstring}'
param sqlAdministratorLogin string
@secure()
param sqlAdministratorLoginPassword string
var blobName = 'storage${randomstring}'
param storageAccountType string
param sqlpoolName string
param bigDataPoolName string
param nodeSize string
param sparkPoolMinNodeCount int
param sparkPoolMaxNodeCount int
param defaultDataLakeStorageFilesystemName string
param collation string
param userObjectId string
param dataLakeUrlFormat string
param location string

//Storage account for deployment scripts
module synapsedeploy 'synapse-workspace.bicep' = {
  name: 'synapsed'
  params: {
    synapseName: synapseName
    location: location
    sqlAdministratorLogin: sqlAdministratorLogin
    sqlAdministratorLoginPassword: sqlAdministratorLoginPassword
    blobName: blobName
    storageAccountType: storageAccountType
    sqlpoolName: sqlpoolName
    bigDataPoolName: bigDataPoolName
    nodeSize: nodeSize
    sparkPoolMinNodeCount: sparkPoolMinNodeCount
    sparkPoolMaxNodeCount: sparkPoolMaxNodeCount
    defaultDataLakeStorageFilesystemName: defaultDataLakeStorageFilesystemName
    collation: collation
    startIpaddress: ipaddress
    endIpAddress: ipaddress
    userObjectId: userObjectId
    dataLakeUrlFormat: dataLakeUrlFormat
  }
}

output resourceSuffix string = randomstring

synapse-workspace.bicep

param synapseName string
param location string
param sqlAdministratorLogin string
@secure()
param sqlAdministratorLoginPassword string
param blobName string
param storageAccountType string
param sqlpoolName string
param bigDataPoolName string
param nodeSize string
param sparkPoolMinNodeCount int
param sparkPoolMaxNodeCount int
param defaultDataLakeStorageFilesystemName string
param collation string
param startIpaddress string
param endIpAddress string
param userObjectId string
param dataLakeUrlFormat string


var storageBlobDataContributorRoleID = 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
var storageRoleUniqueId = guid(resourceId('Microsoft.Storage/storageAccounts', synapseName), blobName)
var storageRoleUserUniqueId = guid(resourceId('Microsoft.Storage/storageAccounts', synapseName), userObjectId)
resource datalakegen2 'Microsoft.Storage/storageAccounts@2021-09-01' = {
  name: blobName
  kind: 'StorageV2'
  location: location
  properties:{
    minimumTlsVersion: 'TLS1_2'
    isHnsEnabled: true
  }
  sku: {
    name: storageAccountType
  }
}

resource blob 'Microsoft.Storage/storageAccounts/blobServices@2021-09-01' = {
  name:  '${datalakegen2.name}/default'
}

resource containera 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-09-01' = {
  name: '${datalakegen2.name}/default/${defaultDataLakeStorageFilesystemName}'
  properties: {
    publicAccess: 'None'
  }
  dependsOn:[
    blob
  ]
} 

resource synapse 'Microsoft.Synapse/workspaces@2021-06-01' = {
  name: synapseName
  location: location
  properties: {
    sqlAdministratorLogin: sqlAdministratorLogin
    sqlAdministratorLoginPassword: sqlAdministratorLoginPassword
    defaultDataLakeStorage:{
      accountUrl: format(dataLakeUrlFormat, datalakegen2.name)
      filesystem: defaultDataLakeStorageFilesystemName
    }
  }
  identity:{
    type:'SystemAssigned'
  }
}

resource synapseroleassing 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
  name: storageRoleUniqueId
  scope: datalakegen2
  properties:{
    principalId: synapse.identity.principalId
    principalType: 'ServicePrincipal'
    roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageBlobDataContributorRoleID)
  }
}

resource userroleassing 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
  name: storageRoleUserUniqueId
  scope: datalakegen2
  properties:{
    principalId: userObjectId
    principalType: 'User'
    roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageBlobDataContributorRoleID)
  }
}

resource manageid4Pipeline 'Microsoft.Synapse/workspaces/managedIdentitySqlControlSettings@2021-06-01' = {
  name: 'default'
  properties: {
    grantSqlControlToManagedIdentity: {
      desiredState:'Enabled'
    }
  }
  parent:synapse
}

resource sqlpool 'Microsoft.Synapse/workspaces/sqlPools@2021-06-01' = {
  name: sqlpoolName
  location: location
  parent: synapse
  sku:{
    name: 'DW100c'
  }
  properties:{
    collation: collation
    createMode: 'Default'
  }
}

resource sparkpool 'Microsoft.Synapse/workspaces/bigDataPools@2021-06-01' = {
  name: bigDataPoolName
  location: location
  parent: synapse
  properties:{
    nodeSize: nodeSize
    nodeSizeFamily: 'MemoryOptimized'
    autoScale:{
      enabled: true
      minNodeCount: sparkPoolMinNodeCount
      maxNodeCount: sparkPoolMaxNodeCount
    }
    autoPause:{
      enabled: true
      delayInMinutes: 15
    }
    sparkVersion: '3.2'
  }
}

// resource allowazure4synapse 'Microsoft.Synapse/workspaces/firewallRules@2021-06-01' = {
//   name: 'AllowAllWindowsAzureIps'
//   properties: {
//     endIpAddress: '0.0.0.0'
//     startIpAddress: '0.0.0.0'
//   }
//   parent: synapse
// }

// resource symbolicname 'Microsoft.Synapse/workspaces/firewallRules@2021-06-01' = {
//   name: 'AllowAccessPoint'
//   properties: {
//     endIpAddress: endIpAddress
//     startIpAddress: startIpaddress
//   }
//   parent: synapse
// }

parameter file.

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {  

        "ipaddress": {
            "value": "xxx.xxx.xxx.xxx"
        },
        "sqlAdministratorLogin": {
          "value" : "adminuser"
        },
        "sqlAdministratorLoginPassword": {
          "value": "dffgf5^645*DGGD2"
        },
        "storageAccountType":{
          "value": "Standard_LRS"
        },
        "sqlpoolName":{
          "value": "sql_pool_1"
        },
        "bigDataPoolName": {
          "value": "etlexecuter"
        },
        "nodeSize":{
          "value": "Small"
        },
        "sparkPoolMinNodeCount":{
            "value": 3
        },
        "sparkPoolMaxNodeCount":{
          "value": 3
        },
        "defaultDataLakeStorageFilesystemName":{
          "value": "dl2"
        },
        "collation":{
          "value": "SQL_LATIN1_GENERAL_CP1_CI_AS"
        },
        "userObjectId":{
          "value": "xxxxxxxxxx"
        },
        "dataLakeUrlFormat":{
          "value": "https://{0}.dfs.core.windows.net"
        }
    }
}

deployment

az deployment group create --resource-group "my-rg" --template-file "D:\bicep\main.bicep" --parameters "D:\bicep\parameters.json" --name synapse_deployment

Solution

  • This is a temporary issue which might cause due to below reasons.

    Verify if there are any ongoing deployments either through the Azure Portal or CLI, as simultaneous deployments by multiple users in the same environment can cause this issue.

    Consider deploying your resources in a different region than the current one. I suggest deploying to the WestUS2 region as it typically has fewer limits on SQL pool resources.

    Sometimes, redeploying the bicep code will work in this kind of scenarios.

    Check bicep and CLI version and upgrade it with az bicep upgrade if it is an outdated version.

    Your code looks good to me for your requirement. I tried the same code in my environment as you and was able to deploy it as shown below.

    param synapseName string
    param location string
    param sqlAdministratorLogin string
    @secure()
    param sqlAdministratorLoginPassword string
    param blobName string
    param storageAccountType string
    param sqlpoolName string
    param bigDataPoolName string
    param nodeSize string
    param sparkPoolMinNodeCount int
    param sparkPoolMaxNodeCount int
    param defaultDataLakeStorageFilesystemName string
    param collation string
    param userObjectId string
    param dataLakeUrlFormat string
    
    
    var storageBlobDataContributorRoleID = 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'
    var storageRoleUniqueId = guid(resourceId('Microsoft.Storage/storageAccounts', synapseName), blobName)
    var storageRoleUserUniqueId = guid(resourceId('Microsoft.Storage/storageAccounts', synapseName), userObjectId)
    resource datalakegen2 'Microsoft.Storage/storageAccounts@2021-09-01' = {
      name: blobName
      kind: 'StorageV2'
      location: location
      properties:{
        minimumTlsVersion: 'TLS1_2'
        isHnsEnabled: true
      }
      sku: {
        name: storageAccountType
      }
    }
    
    resource blob 'Microsoft.Storage/storageAccounts/blobServices@2021-09-01' = {
      name:  '${datalakegen2.name}/default'
    }
    
    resource containera 'Microsoft.Storage/storageAccounts/blobServices/containers@2021-09-01' = {
      name: '${datalakegen2.name}/default/${defaultDataLakeStorageFilesystemName}'
      properties: {
        publicAccess: 'None'
      }
      dependsOn:[
        blob
      ]
    } 
    
    resource synapse 'Microsoft.Synapse/workspaces@2021-06-01-preview' = {
      name: synapseName
      location: location
      properties: {
        sqlAdministratorLogin: sqlAdministratorLogin
        sqlAdministratorLoginPassword: sqlAdministratorLoginPassword
        defaultDataLakeStorage:{
          accountUrl: format(dataLakeUrlFormat, datalakegen2.name)
          filesystem: defaultDataLakeStorageFilesystemName
        }
      }
      identity:{
        type:'SystemAssigned'
      }
    }
    
    resource synapseroleassing 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
      name: storageRoleUniqueId
      scope: datalakegen2
      properties:{
        principalId: synapse.identity.principalId
        principalType: 'ServicePrincipal'
        roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageBlobDataContributorRoleID)
      }
    }
    
    resource userroleassing 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = {
      name: storageRoleUserUniqueId
      scope: datalakegen2
      properties:{
        principalId: userObjectId
        principalType: 'User'
        roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', storageBlobDataContributorRoleID)
      }
    }
    
    resource manageid4Pipeline 'Microsoft.Synapse/workspaces/managedIdentitySqlControlSettings@2021-06-01' = {
      name: 'default'
      properties: {
        grantSqlControlToManagedIdentity: {
          desiredState:'Enabled'
        }
      }
      parent:synapse
    }
    
    resource sqlpool 'Microsoft.Synapse/workspaces/sqlPools@2021-06-01' = {
      name: sqlpoolName
      location: location
      parent: synapse
      sku:{
        name: 'DW100c'
      }
      properties:{
        collation: collation
        createMode: 'Default'
      }
    }
    
    resource sparkpool 'Microsoft.Synapse/workspaces/bigDataPools@2021-06-01' = {
      name: bigDataPoolName
      location: location
      parent: synapse
      properties:{
        nodeSize: nodeSize
        nodeSizeFamily: 'MemoryOptimized'
        autoScale:{
          enabled: true
          minNodeCount: sparkPoolMinNodeCount
          maxNodeCount: sparkPoolMaxNodeCount
        }
        autoPause:{
          enabled: true
          delayInMinutes: 15
        }
        sparkVersion: '3.2'
      }
    }
    
    {
      "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "synapseName": {
          "value": "mynewsynap"
        },
        "location": {
          "value": "westus2"
        },
        "sqlAdministratorLogin": {
          "value": "roots"
        },
        "sqlAdministratorLoginPassword": {
          "value": "Jaanu@041297"
        },
        "blobName": {
          "value": "newblobjah"
        },
        "storageAccountType": {
          "value": "Standard_LRS"
        },
        "sqlpoolName": {
          "value": "mypoolj"
        },
        "bigDataPoolName": {
          "value": "bigpoolj"
        },
        "nodeSize": {
          "value": "Small"
        },
        "sparkPoolMinNodeCount": {
          "value": 3
        },
        "sparkPoolMaxNodeCount": {
          "value": 10
        },
        "defaultDataLakeStorageFilesystemName": {
          "value": "dl2"
        },
        "collation": {
          "value": "SQL_LATIN1_GENERAL_CP1_CI_AS"
        },
        "userObjectId": {
          "value": "b5xxxx18"
        },
        "dataLakeUrlFormat": {
          "value": "https://{0}.dfs.core.windows.net"
        }
      }
    }
    

    Deployment succeeded:

    enter image description here

    enter image description here

    enter image description here