Azure / Azure/Azure-DataFactory
Bug: ARM Template generator produces circular dependsOn with “Default staging linked service”
- Dominant language
- PowerShell
- Stars
- 529
- Forks
- 623
- PR merge metrics
- No merged PRs in 30d
Description
# Bug: ARM Template generator produces circular `dependsOn` with “Default staging linked service”
**Package:** `@microsoft/azure-data-factory-utilities`
**Package Version:** *1.0.3*
**Node.js Version:** *v24.13.0*
**NPM Version:** *11.6.2*
**OS:** *Azure Pipelines ubuntu-latest*
## Description
When using **`@microsoft/azure-data-factory-utilities`** to generate an ARM template, enabling the **Default staging linked service** in Azure Data Factory (Manage → Factory Settings) causes the generator to produce an invalid ARM template.
The factory resource in the generated ARM template includes a `dependsOn` referencing a child linked service, creating a **circular dependency**:
- `Microsoft.DataFactory/factories/linkedServices` is a child of the factory
- The factory cannot depend on its own child resources
Disabling the staging linked service resolves the issue and generates a valid ARM template.
---
## Steps to Reproduce
1. In ADF, configure **Default staging linked service** in Manage → Factory Settings.
2. Use `@microsoft/azure-data-factory-utilities` to generate an ARM template.
```yaml
# https://aka.ms/yaml
pool:
vmImage: 'ubuntu-latest'
variables:
- name: 'AzureSubscriptionID'
value: ''
- name: 'AzureResourceGroupName'
value: ''
- name: 'AzureDataFactoryName'
value: ''
- name: 'AzureDataFactorySubscriptionPath'
value: '/subscriptions/$(AzureSubscriptionID)/resourceGroups/$(AzureResourceGroupName)/providers/Microsoft.DataFactory/factories/$(AzureDataFactoryName)'
steps:
- checkout: self
- task: NodeTool@0
inputs:
versionSpec: '24.x'
displayName: 'Install Node.js'
- task: Npm@1
inputs:
command: 'install'
workingDir: '$(Build.SourcesDirectory)'
displayName: 'Install npm package @microsoft/azure-data-factory-utilities'
- task: Npm@1
inputs:
command: 'custom'
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'run build validate $(Build.SourcesDirectory) $(AzureDataFactorySubscriptionPath)'
displayName: 'Validate'
- task: Npm@1
inputs:
command: 'custom'
workingDir: '$(Build.SourcesDirectory)'
customCommand: 'run build-preview export $(Build.SourcesDirectory) $(AzureDataFactorySubscriptionPath) $(Build.ArtifactStagingDirectory)'
displayName: 'Validate and Generate ARM template'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'ArmTemplates'
publishLocation: 'pipeline'
```
3. Inspect the factory resource in the ARM template. Example snippet:
```json
{
"name": "[parameters('factoryName')]",
"type": "Microsoft.DataFactory/factories",
"apiVersion": "2018-06-01",
"properties": {
"globalParameters": { ... },
"globalConfigurations": { ... }
},
"dependsOn": [
"[concat(variables('factoryId'), '/linkedServices/AzureDataLakeStorage')]"
],
"location": "[parameters('dataFactory_location')]"
}
```
4. Deploying or validating this template with ARM fails due to the circular dependency.
5. Remove the staging linked service from the factory configuration, regenerate → the `dependsOn` disappears, and the template becomes valid.
---
## Expected Behaviour
The factory resource should not include `dependsOn` on its child linked services, even if referenced in global configurations.
---
## Workarounds
- Manually remove the `dependsOn` from the factory resource in the generated template.
- Avoid using the Default staging linked service setting until the bug is fixed.
Contributor guide
Assessment
This issue has not been assessed yet.