skip to Main Content

We are trying to create an Azure Data Factory Linked Service for an Azure Batch account using Terraform. However, there is no native resource available in Terraform documentation for creating an Azure Batch Linked Service directly. To work around this, we attempted to use a custom-linked service. But, we are encountering an "Invalid Payload" error with the type "AzureBatch." We need assistance in resolving this issue and successfully creating the Azure Batch Linked Service using Terraform. Any guidance or solutions would be highly appreciated.

Reference:- https://learn.microsoft.com/en-us/azure/templates/microsoft.datafactory/factories/linkedservices?pivots=deployment-language-terraform#azurebatchlinkedservice-2

enter image description here

2

Answers


  1. According to the sample template from terraform registry, I checked your code and tried to create Azure Batch linked service in my environment using azurerm_data_factory_linked_custom_service resource and was able to run it successfully as follows.

    resource "azurerm_resource_group" "main" {
      name     = "example-resources"
      location = "West Europe"
    }
    resource "azurerm_data_factory" "main" {
      name                = "examplejambar"
      location            = azurerm_resource_group.main.location
      resource_group_name = azurerm_resource_group.main.name
      identity {
        type = "SystemAssigned"
      }
    }
    resource "azurerm_storage_account" "main" {
      name                     = "examplelocker"
      resource_group_name      = azurerm_resource_group.main.name
      location                 = azurerm_resource_group.main.location
      account_kind             = "BlobStorage"
      account_tier             = "Standard"
      account_replication_type = "LRS"
    }
    resource "azurerm_data_factory_linked_custom_service" "main" {
      name                 = "mainsample"
      data_factory_id      = azurerm_data_factory.main.id
      type                 = "AzureBlobStorage"
      description          = "test description"
      type_properties_json = <<JSON
    {
     "connectionString":"${azurerm_storage_account.main.primary_connection_string}"
    }
    JSON
    
      parameters = {
        "foo" : "bar"
        "Env" : "Test"
      }
    
      annotations = [
        "test1",
        "test2",
        "test3"
      ]
    }
    

    Initialized & validated the configuration:

    enter image description here

    Executed terraform plan:

    enter image description here

    Executed terraform apply:

    enter image description here

    Deployed successfully:

    enter image description here

    Login or Signup to reply.
  2. The error is Invalid linked service payload, the "typeProperties" nested in payload is null.. shows that you have an issue with "connectionString":"${data.azurerm_storage_account.example.primary_connection_string}" config line.

    Please double check that you have needed azurerm_storage_account, and data.azurerm_storage_account.example.primary_connection_string return correct connection string.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search