Table of Contents

Deploying ML models to Azure

For deploying ML models to Azure you need to follow the stages as mentioned 

Pre-requisites for deployment of ML model to Azure 

  1. Creating the Azure Machine Learning workspace 
  1. A trained ML Model 
  1. Using the Azure CLI extension for Machine learning services 
  1. A docker running machine 
  1. Register and track the ML model 

Model registration helps you in storing version of your ML model in your workspace on Azure cloud. The registration of the model is done by the name and the version of the model. It is a good practice to provide extra metadata tags during registration. These tags enable easy searching of the model on Azure. Azure ML supports any model loaded with Python 3.5.2 or higher versions. For registering your model, you need resources like a pytorch model file which can represent the specific model and codes executing the model. 

You can register your model from  

  1. a local file or  

!wget -o model.onnx 

!az ml model register -n bidaf_onnx -p ./model.onnx 

  1. an Azure ML training run 

az ml model register -n bidaf_onnx –asset-path outputs/model.onnx –experiment-name myexperiment –run-id myrunid –tag area=qna 

  1. Creating the entry script 

The entry script is required for accepting the requests, scoring the requests with the ML model and returning the result output. Your entry script should enable you to load your model using the (in (it) function and use the input data to run the model with run function 

import json 

def init(): 

    print(“This is init”) 

def run(data): 

    test = json.loads(data) 

    print(f”received data {test}”) 

    return f”test is {test}” 

  1. Creating the inference configuration 

The inference configuration details the docker containers alongwith files to be used while initialising the web service. The source directory files are pushed to cloud when you start deploying the web service 

  1. Deploy the ML model 

After this, you are fully prepared to deploy the ML model 

!az ml model deploy -n myservice -m model name –overwrite –ic dummyinferenceconfig.json –dc deploymentconfig.json 

!az ml service get-logs -n myservice 

  1. Conduct liveness Request 

To ensure that you have deployed the ML model successfully , you need to conduct a liveness request and a scoring request 

!curl -v http://localhost:32267 

!curl -v -X POST -H “content-type:application/json” -d ‘{“query”: “What color is the fox”, “context”: “The quick brown fox jumped over the lazy dog.”}’ http://localhost:32267/score 

Ready to experience the full power of cloud technology?

Our cloud experts will speed up cloud deployment, and make your business more efficient.  

  1. Select a compute target 

Select a compute target based on assessment so that the cost and the availability is optimised for your endpoints that have been deployed 

  1. Re-deploy the model to cloud 

Once you have ensured that your ML model is working fit and fine locally and you have selected the right compute target, it is time for redeployment to cloud. 

The deployment configuration would differ based on the compute target you have selected 

    “computeType”: “aci”, 



        “cpu”: 0.5, 

        “memoryInGB”: 1.0 


    “authEnabled”: true, 

    “sslEnabled”: false, 

    “appInsightsEnabled”: false 

Contact Our DevOps

Get Free Consultation

Liked what you read !

Please leave a Feedback

Leave a Reply

Your email address will not be published. Required fields are marked *

Join the sustainability movement

Is your carbon footprint leaving a heavy mark? Learn how to lighten it! ➡️

Register Now

Calculate Your DataOps ROI with Ease!

Simplify your decision-making process with the DataOps ROI Calculator, optimize your data management and analytics capabilities.

Calculator ROI Now!

Related articles you may would like to read

Leveraging IT staff augmentation for effective data management and data architecture
Leveraging IT Staff Augmentation for Effective Data Management and Data Architecture 
How IT Staff Augmentation services flexibility and agility to IT departments
How IT staff augmentation services offer flexibility and agility to IT departments 
Educational Empowerment with IT Staff Augmentation in EdTech Advancements
Educational Empowerment with IT Staff Augmentation in EdTech Advancements 

Know the specific resource requirement for completing a specific project with us.


Keep yourself updated with the latest updates about Cloud technology, our latest offerings, security trends and much more.


Gain insights into latest aspects of cloud productivity, security, advanced technologies and more via our Virtual events.

ISmile Technologies delivers business-specific Cloud Solutions and Managed IT Services across all major platforms maximizing your competitive advantage at an unparalleled value.

Request a Consultation