Sauron
Sauron

Reputation: 6647

Error creating Azure Synapse Pool with Terraform

I am simply attempting to create an Azure Synapse Analytics Pool with Terraform. I can create just about every other resource I need, but the creation of the FileSystem in the storage account is causing issues (I need a filesystem because synapse pool needs a workspace which needs a filesystem). I am getting the error as below: enter image description here

Below is my script, has anyone done this successfully?:

# Configure the Microsoft Azure Provider.
terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = ">= 2.26"
    }
  }
}

provider "azurerm" {
  features {}
}


# Create a resource group
resource "azurerm_resource_group" "rg" {
  name     = "kjTEST"
  location = "eastus"
}



#** Storage account ** will most likely replace with references to existing storage accounts
resource "azurerm_storage_account" "storage" {
  name                     = "kjastoragetest"
  resource_group_name      = azurerm_resource_group.rg.name
  location                 = azurerm_resource_group.rg.location
  account_tier             = "Standard"
  is_hns_enabled           = "true"
  account_replication_type = "LRS"
  account_kind             = "StorageV2"
}

resource "azurerm_storage_container" "container" {
  name                  = "testcontainer"
  storage_account_name  = azurerm_storage_account.storage.name
  container_access_type = "blob"
}

# File system
resource "azurerm_storage_data_lake_gen2_filesystem" "filesystem" {
  name               = "filesystem"
  storage_account_id = azurerm_storage_account.storage.id
}

# Synapse 
resource "azurerm_synapse_workspace" "workspace" {
  name                                 = "example"
  resource_group_name                  = azurerm_resource_group.rg.name
  location                             = azurerm_resource_group.rg.location
  storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.filesystem.id
  sql_administrator_login              = "usnername89"
  sql_administrator_login_password     = "########"
}

# 
resource "azurerm_synapse_sql_pool" "synapsepool" {
  name                 = "kjatestsqlpool"
  synapse_workspace_id = azurerm_synapse_workspace.workspace.id
  sku_name             = "DW100c"
  create_mode          = "Default"
}

Upvotes: 0

Views: 1640

Answers (1)

CHEEKATLAPRADEEP
CHEEKATLAPRADEEP

Reputation: 12768

To successfully launch Spark pools in Azure Synapse workspace, the Azure Synapse managed identity needs the Storage Blob Data Contributor role on this storage account.

Reference: Grant the managed identity permissions to ADLS Gen2 storage account

Upvotes: 2

Related Questions