🐛 Problem
When deploying a FinOps hub via Deploy-FinOpsHub, the deployment script Init-DataFactory.ps1 fails if the Event Grid subscription is already being provisioned (e.g., from a previous deployment attempt or a redeployment).
In Set-BlobTriggerSubscription, the Add-AzDataFactoryV2TriggerSubscription call and the Get-AzDataFactoryV2TriggerSubscriptionStatus check are inside the same Invoke-WithRetry block. This causes two problems:
- The status is checked immediately after subscribing, so it always finds
Provisioning and throws.
- On retry,
Add-AzDataFactoryV2TriggerSubscription is called again while already provisioning, which fails with Resource cannot be updated during provisioning (BadRequest).
All 20 retries are exhausted and the deployment fails.
👣 Repro steps
- Run
Deploy-FinOpsHub -Name MyFinOpsHub -ResourceGroupName my-resource-group -Location eastus
- The deployment script calls
Init-DataFactory.ps1 -StartTriggers
Set-BlobTriggerSubscription calls Add-AzDataFactoryV2TriggerSubscription, then immediately checks status
- Status is
Provisioning, retry re-calls Add which gets Resource cannot be updated during provisioning
- Deployment fails after exhausting all retries
🤔 Expected
The subscription operation and the status polling should be separate steps so the script waits for provisioning to complete instead of re-calling the subscribe operation.
ℹ️ Additional context
Error trace from the deployment failure:
System.Management.Automation.RuntimeException: Subscription status is Provisioning, expected Enabled
...
Microsoft.Rest.Azure.CloudException: HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Resource cannot be updated during provisioning
File: src/templates/finops-hub/modules/fx/scripts/Init-DataFactory.ps1, function Set-BlobTriggerSubscription.
🙋♀️ Ask for the community
We could use your help:
- Please vote this issue up (👍) to prioritize it.
- Leave comments to help us solidify the vision.
🐛 Problem
When deploying a FinOps hub via
Deploy-FinOpsHub, the deployment scriptInit-DataFactory.ps1fails if the Event Grid subscription is already being provisioned (e.g., from a previous deployment attempt or a redeployment).In
Set-BlobTriggerSubscription, theAdd-AzDataFactoryV2TriggerSubscriptioncall and theGet-AzDataFactoryV2TriggerSubscriptionStatuscheck are inside the sameInvoke-WithRetryblock. This causes two problems:Provisioningand throws.Add-AzDataFactoryV2TriggerSubscriptionis called again while already provisioning, which fails withResource cannot be updated during provisioning(BadRequest).All 20 retries are exhausted and the deployment fails.
👣 Repro steps
Deploy-FinOpsHub -Name MyFinOpsHub -ResourceGroupName my-resource-group -Location eastusInit-DataFactory.ps1 -StartTriggersSet-BlobTriggerSubscriptioncallsAdd-AzDataFactoryV2TriggerSubscription, then immediately checks statusProvisioning, retry re-calls Add which getsResource cannot be updated during provisioning🤔 Expected
The subscription operation and the status polling should be separate steps so the script waits for provisioning to complete instead of re-calling the subscribe operation.
ℹ️ Additional context
Error trace from the deployment failure:
File:
src/templates/finops-hub/modules/fx/scripts/Init-DataFactory.ps1, functionSet-BlobTriggerSubscription.🙋♀️ Ask for the community
We could use your help: