Skip to content

Commit 4e4b7ce

Browse files
committed
updated doc for web app release
1 parent 1279bb0 commit 4e4b7ce

File tree

1 file changed

+64
-43
lines changed

1 file changed

+64
-43
lines changed

docs/getting_started.md

Lines changed: 64 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Please make note of the following values after creating a service principal, we
2020
- Application Secret
2121

2222

23-
**Note:** You must have sufficient permissions to register an application with your Azure AD tenant, and assign the application to a role in your Azure subscription. Contact your subscription adminstator if you don't have the permissions. Normally a subscription admin can create a Service principal and can provide you the details.
23+
**Note:** You must have sufficient permissions to register an application with your Azure AD tenant, and assign the application to a role in your Azure subscription. Contact your subscription administrator if you don't have the permissions. Normally a subscription admin can create a Service principal and can provide you the details.
2424

2525

2626
### 4. Create a Variable Group
@@ -29,26 +29,26 @@ We make use of variable group inside Azure DevOps to store variables and their v
2929

3030
Please name your variable group **``devopsforai-aml-vg``** as we are using this name within our build yaml file.
3131

32-
The varibale group should contain the following variables:
33-
34-
| Variable Name | Suggested Value |
35-
| --- | --- |
36-
| AML_COMPUTE_CLUSTER_CPU_SKU | STANDARD_DS2_V2 |
37-
| AML_COMPUTE_CLUSTER_NAME | train-cluster |
38-
| AML_WORKSPACE_NAME | mlops-AML-WS |
39-
| BASE_NAME | mlops |
40-
| EVALUATE_SCRIPT_PATH | evaluate/evaluate_model.py |
41-
| EXPERIMENT_NAME | mlopspython |
42-
| LOCATION | centralus |
43-
| MODEL_NAME | sklearn_regression_model.pkl |
44-
| REGISTER_SCRIPT_PATH | register/register_model.py |
45-
| RESOURCE_GROUP | mlops-AML-RG |
46-
| SOURCES_DIR_TRAIN | code |
47-
| SP_APP_ID | |
48-
| SP_APP_SECRET | |
49-
| SUBSCRIPTION_ID | |
50-
| TENANT_ID | |
51-
| TRAIN_SCRIPT_PATH | training/train.py |
32+
The variable group should contain the following variables:
33+
34+
| Variable Name | Suggested Value |
35+
| --------------------------- | ---------------------------- |
36+
| AML_COMPUTE_CLUSTER_CPU_SKU | STANDARD_DS2_V2 |
37+
| AML_COMPUTE_CLUSTER_NAME | train-cluster |
38+
| AML_WORKSPACE_NAME | mlops-AML-WS |
39+
| BASE_NAME | mlops |
40+
| EVALUATE_SCRIPT_PATH | evaluate/evaluate_model.py |
41+
| EXPERIMENT_NAME | mlopspython |
42+
| LOCATION | centralus |
43+
| MODEL_NAME | sklearn_regression_model.pkl |
44+
| REGISTER_SCRIPT_PATH | register/register_model.py |
45+
| RESOURCE_GROUP | mlops-AML-RG |
46+
| SOURCES_DIR_TRAIN | code |
47+
| SP_APP_ID | |
48+
| SP_APP_SECRET | |
49+
| SUBSCRIPTION_ID | |
50+
| TENANT_ID | |
51+
| TRAIN_SCRIPT_PATH | training/train.py |
5252

5353
Mark **SP_APP_SECRET** variable as a secret one.
5454

@@ -173,15 +173,15 @@ Create a stage **QA (ACI)** and add a single task to the job **Azure ML Model De
173173
Specify task parameters as it is shown in the table below:
174174

175175

176-
| Parameter | Value |
177-
| --- | --- |
178-
| Display Name | Azure ML Model Deploy |
179-
| Azure ML Workspace | mlops-AML-WS |
180-
| Inference config Path | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/inference_config.yml` |
181-
| Model Deployment Target | Azure Container Instance |
182-
| Deployment Name | mlopspython-aci |
176+
| Parameter | Value |
177+
| ----------------------------- | ---------------------------------------------------------------------------------------------------- |
178+
| Display Name | Azure ML Model Deploy |
179+
| Azure ML Workspace | mlops-AML-WS |
180+
| Inference config Path | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/inference_config.yml` |
181+
| Model Deployment Target | Azure Container Instance |
182+
| Deployment Name | mlopspython-aci |
183183
| Deployment Configuration file | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/deployment_config_aci.yml` |
184-
| Overwrite existing deployment | X |
184+
| Overwrite existing deployment | X |
185185

186186

187187
In a similar way create a stage **Prod (AKS** and add a single task to the job **Azure ML Model Deploy**:
@@ -190,25 +190,46 @@ In a similar way create a stage **Prod (AKS** and add a single task to the job *
190190

191191
Specify task parameters as it is shown in the table below:
192192

193-
| Parameter | Value |
194-
| --- | --- |
195-
| Display Name | Azure ML Model Deploy |
196-
| Azure ML Workspace | mlops-AML-WS |
197-
| Inference config Path | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/inference_config.yml` |
198-
| Model Deployment Target | Azure Kubernetes Service |
199-
| Select AKS Cluster for Deployment | YOUR_DEPLOYMENT_K8S_CLUSTER |
200-
| Deployment Name | mlopspython-aks |
201-
| Deployment Configuration file | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/deployment_config_aks.yml` |
202-
| Overwrite existing deployment | X |
193+
| Parameter | Value |
194+
| --------------------------------- | ---------------------------------------------------------------------------------------------------- |
195+
| Display Name | Azure ML Model Deploy |
196+
| Azure ML Workspace | mlops-AML-WS |
197+
| Inference config Path | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/inference_config.yml` |
198+
| Model Deployment Target | Azure Kubernetes Service |
199+
| Select AKS Cluster for Deployment | YOUR_DEPLOYMENT_K8S_CLUSTER |
200+
| Deployment Name | mlopspython-aks |
201+
| Deployment Configuration file | `$(System.DefaultWorkingDirectory)/_ci-build/mlops-pipelines/code/scoring/deployment_config_aks.yml` |
202+
| Overwrite existing deployment | X |
203203

204204
**Note:** Creating of a Kubernetes cluster on AKS is out of scope of this tutorial, so you should take care of it on your own.
205205

206-
Save the pipeline and craete a release to trigger it manually. Once the pipeline exection is finished, check out deployments in the **mlops-AML-WS** workspace.
206+
**Deploy trained model to Azure Web App for containers**
207+
208+
[Create Image Script](./ml_service/util/create_scoring_image.py)
209+
can be used to create a scoring image from the release pipeline. Image created by this script will be registered under Azure Container Registry(ACR) instance that belongs to Azure Machine Learning Service. Any dependencies that scoring file depends on can also be packaged with the container with Image config. To learn more on how to create a container with AML SDK click [here](https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.image.image.image?view=azure-ml-py#create-workspace--name--models--image-config-).
210+
211+
Below is release pipeline with two tasks one to create an image using the above script and second is the deploy the image to Web App for containers
212+
![release_webapp](./images/release-webapp-pipeline.PNG)
213+
214+
Using bash script task to invoke [Create Image Script](./ml_service/util/create_scoring_image.py)
215+
![release_createimage](./images/release-task-createimage.PNG)
216+
217+
Specify task parameters as it is shown in the table below:
218+
| Parameter | Value |
219+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
220+
| Azure Subscription | Subscription used to deploy Web App |
221+
| App name | Web App for Containers name |
222+
| Image name | $(acr_url)/$(image_name):$(image_version) where pipeline variables forms the fully qualified container image name. For example, 'myregistry.azurecr.io/nginx:latest' |
223+
224+
![release_webapp](./images/release-task-webappdeploy.PNG)
225+
226+
227+
Save the pipeline and create a release to trigger it manually. Once the pipeline execution is finished, check out deployments in the **mlops-AML-WS** workspace.
207228

208229

209230

210231
Congratulations! You have three pipelines set up end to end:
211-
- Build pipeline: triggered on code change to master branch on GitHub, performs linting, unit testing and publishing a trainig pipeline
212-
- Release Trigger pipeline: runs a published training pipeline to trian, evaluate and register a model
213-
- Release Deployment pipeline: deploys a model to QA (ACI) and Prod (AKS) environemts
232+
- Build pipeline: triggered on code change to master branch on GitHub, performs linting, unit testing and publishing a training pipeline
233+
- Release Trigger pipeline: runs a published training pipeline to train, evaluate and register a model
234+
- Release Deployment pipeline: deploys a model to QA (ACI) and Prod (AKS) environments
214235

0 commit comments

Comments
 (0)