Creating a MarketplaceSubscription with azapi results of an error

Boubnane, Hamza 25 Reputation points
2025-06-13T12:05:41.7+00:00

Hello,

I'm trying to deploy a MarketplaceSubscription using azapi but I always get :

Another operation with ID [id] is already running on marketplace subscription []. Please wait until the the current operation completes."

The Azure ML is fresh, there's no other market subscription operation at the same time.
Even after deleting Azure ML, checking if there's a subscription with :

az ml marketplace-subscription list --workspace-name NAME --resource-group RG

It says there's none but once trying to do terraform apply, the same message is occuring.

The weird behaviour is, even stating that there's an operation is already running, when I check manually in the Model Catalog in Azure ML, I can see that it got created successfully

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,350 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ravada Shivaprasad 550 Reputation points Microsoft External Staff Moderator
    2025-06-13T16:55:11.8733333+00:00

    Hi Boubnane, Hamza

    When deploying Azure Marketplace subscriptions, you might encounter an error indicating that "another operation with ID [id] is already running" despite having no active operations visible in the Azure ML workspace or CLI outputs.

    This occurs because Azure uses an asynchronous two-phase commit system for deployments, where operation IDs persist independently of actual resource existence.

    Even though the Model Catalog in Azure ML shows successful creation, backend state tracking continues until all deployment phases complete, causing Terraform to detect these pending states.

    The solution involves waiting for 15 minutes to allow cleanup, force-deleting existing subscriptions, verifying complete resource removal, and retrying deployment with Terraforms refresh-only mode.

    This behavior is particularly common with Marketplace subscriptions due to their complex deployment lifecycle, where portal UI updates faster than backend state resolution, creating temporary mismatches between visible and actual states.

    # Wait for 15 minutes to allow cleanup
    sleep 900
    #Force Deletion the Existing Subscription
    az ml marketplace-subscription delete \
      --name YOUR_SUBSCRIPTION_NAME \
      --workspace-name YOUR_WORKSPACE \
      --resource-group YOUR_RG \
      --yes
    #Verify Complete Cleanup
    # Check subscription status
    az ml marketplace-subscription list \
      --workspace-name YOUR_WORKSPACE \
      --resource-group YOUR_RG
    # Verify resource group operations
    az resource-group operation list \
      --resource-group YOUR_RG \
      --query "[?targetResource.resourceName=='YOUR_WORKSPACE']"
    # Retry Deployment
    terraform apply -refresh-only
    

    If the issue still persists, Please follow below Troubleshooting steps

    # Check Resource provider Status
    az provider show -n Microsoft.MachineLearningServices
    
    # Verify Role Assignments
    
    az role assignment list \
      --assignee YOUR_PRINCIPAL_ID \
      --resource-group YOUR_RG
    
    # Monitor Active log
    
    az monitor activity-log list \
      --filter "resourceGroupName eq 'YOUR_RG'" \
      --query "[?operationName.value contains 'MarketplaceSubscription']"
    
    

    Hope this helps!

    Thank you!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.