Automating Deployment of custom vision object Detection Model across subscriptions

Pallavi M 0 Reputation points
2025-03-10T05:13:44.1+00:00

I have deployed a Custom Vision Object Detection model in my Custom Vision resource within my Azure subscription. Now, I want to automate its deployment to another subscription.

Is it possible to achieve this using Azure DevOps? If so, what steps should I follow? Are there any other recommended approaches, such as using ARM templates, Terraform, or Azure CLI?

Looking for guidance on the best way to automate this process. Thanks in advance!

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,223 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pavankumar Purilla 4,280 Reputation points Microsoft External Staff
    2025-03-10T22:58:21.3633333+00:00

    Hi Pallavi M,
    Yes, automating the deployment of a Custom Vision Object Detection model across Azure subscriptions is possible using Azure DevOps, ARM templates, Terraform, or Azure CLI.

    Azure DevOps provides pipelines that can automate the deployment process.

    Export the Custom Vision Model:

    Use the Custom Vision portal or API to export your trained model. Ensure the model is in a format compatible with your deployment target (e.g., TensorFlow, ONNX).

    Prepare Deployment Scripts:

    • Create deployment scripts using Azure CLI or PowerShell to deploy the exported model to the target subscription.
    • Include commands to create or update the necessary resources (e.g., Custom Vision resource, storage accounts, etc.).

    Set Up Azure DevOps Pipeline:

    • Repository: Store your deployment scripts and configuration files in a Git repository.

    Pipeline Configuration:

    • Create a pipeline in Azure DevOps.

    Add tasks to:

    • Authenticate with Azure using a service principal.
    • Execute deployment scripts to deploy the model to the target subscription.
    • Use variables or parameter files to handle subscription-specific details.

    Testing and Validation:

    • Add pipeline stages for testing and validating the deployment in the target subscription.

    Using ARM Templates

    Export ARM Template:

    Use the Azure portal to export the ARM template for your Custom Vision resource.

    Modify the template to make it reusable across subscriptions (e.g., parameterize subscription-specific values).

    Deploy Using Azure CLI or Azure DevOps:

    • Use the az deployment group create command to deploy the ARM template to the target subscription.
    • Alternatively, integrate the ARM template deployment into an Azure DevOps pipeline.

    Using Terraform

    Write Terraform Configuration:

    • Define the Custom Vision resource and other dependencies in Terraform .tf files.
    • Use variables to parameterize subscription-specific details.

    Set Up Terraform Workflow:

    • Use terraform init, terraform plan, and terraform apply commands to deploy the resources.
    • Store the Terraform state file securely (e.g., in Azure Storage or Terraform Cloud).

    Automate with Azure DevOps:

    • Create an Azure DevOps pipeline to execute Terraform commands and deploy the resources.

    Using Azure CLI

    Write Deployment Script:

    • Use Azure CLI commands to create or update the Custom Vision resource and deploy the model.
    • Include commands to authenticate with the target subscription.
    • Automate with Azure DevOps or Local Scripts:
    • Integrate the script into an Azure DevOps pipeline or run it locally for automation.

    Hope this helps. Do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    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.