Home > Blockchain >  Bicep ADF LinkedService
Bicep ADF LinkedService

Time:12-30

I'm having a heck of a time trying to deploy a simple Azure BlobFS linked service into an ADF using Bicep (which I have only really started to learn).

The bicep I have thus far is:

//---Data Factory
resource datafactory 'Microsoft.DataFactory/factories@2018-06-01' = {
  name: adf_name
  location: loc_name
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    globalParameters: {}
    publicNetworkAccess: 'Enabled'
  }
}

//--- Data Factory Linked Service
resource adls_linked_service 'Microsoft.DataFactory/factories/linkedservices@2018-06-01' = {
  name: 'ls_adf_to_adls'
  parent: datafactory
  properties: {
    annotations: []
    connectVia: {
      parameters: {}
      referenceName: 'AutoResolveIntegrationRuntime'
      type: 'IntegrationRuntimeReference'
    }
    description: 'linked_service_for_adls'
    parameters: {}
    type: 'AzureBlobFS'
    typeProperties: {
      accountKey: datafactory.identity.principalId
      azureCloudType: 'AzurePublic'
      credential: {
        referenceName: 'string'
        type: 'CredentialReference'
      }
      servicePrincipalCredentialType: 'SecureString'
      servicePrincipalId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
      servicePrincipalKey: {
        type: 'SecureString'
        value: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
      }
      tenant: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
      url: bicepstorage.properties.primaryEndpoints.blob
    }
  }
}

The ADF resource deploys fine by itself as does the ADLS (symbolic name is: bicepstorage). The issue is when I added the linkedservice resource block. I get:

New-AzResourceGroupDeployment: /home/vsts/work/1/s/psh/deploy_main.ps1:12
Line |
  12 |  New-AzResourceGroupDeployment `
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 22:46:27 - The deployment 'main' failed with error(s). Showing 1 out of
     | 1 error(s). Status Message: Input is malformed. Reason: Could not get
     | integration runtime details for AutoResolveIntegrationRuntime
     | (Code:InputIsMalformedDetailed)  CorrelationId:
     | f77ef878-5314-46ea-9de6-65807845a104

The only integration runtime in the ADF is the 'AutoResolveIntegrationRuntime'. When I inspect it in the portal it's green, running and healthy.

I'm using task: AzurePowerShell@5 on ubuntu-latest in ADF, but I get the same error when I try to deploy the template directly from vscode.

I'm out of ideas and would really appreciate some assistance. I found the documentation for the 'connectVia' block (actually all the documentation on bicep linked services!) to be really confusing; if anyone could tell me exactly what is supposed to go in there, I'd really appreciate it.

Thanks.

CodePudding user response:

As mentioned in enter image description here

To test this I have created a bicep template which will deploy adlsgen2 storage account, data factory and a linked service to it using the service principal based authentication.

Here is the sample template for your reference:

param location string='westus'

//---Data Factory
resource storage 'Microsoft.Storage/storageAccounts@2022-09-01'={
  name:'<storageAccountName>'
  location:location
  kind:'StorageV2'
  sku:{
    name:'Standard_GRS'
  }
  properties:{
    accessTier:'Hot'
    supportsHttpsTrafficOnly:true
    isHnsEnabled:true
  }
}
resource datafactory 'Microsoft.DataFactory/factories@2018-06-01' = {
  name: '<AdfName>'
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    globalParameters: {}
    publicNetworkAccess: 'Enabled'
  }
}
//--- Data Factory Linked Service
resource adls_linked_service 'Microsoft.DataFactory/factories/linkedservices@2018-06-01' = {
  name: '<linkedserviceName>'
  parent: datafactory
  properties: {
    annotations: []
    description: 'linked_service_for_adls'
    parameters: {}
    type: 'AzureBlobFS'
    typeProperties: {
      url: storage.properties.primaryEndpoints.dfs
      //encryptedCredential:storage.listKeys(storage.id).keys[0].value
      servicePrincipalCredential: {
        type: 'SecureString'
        value: '<serviceprincipalKey>'
      }
      servicePrincipalId:'<serviceprincipalappId>'
      servicePrincipalCredentialType:'ServicePrincipalKey'
      azureCloudType:'AzurePublic'
      servicePrincipalKey: {
        type: 'SecureString'
        value: '<serviceprincipalKey>'
      }
      tenant: '<tenantId>'      
    }
  }
}
  • Related