{"id":28379079,"url":"https://github.com/mathurutkarsh/mlops-with-github-actions-and-aml","last_synced_at":"2025-10-07T20:18:00.855Z","repository":{"id":65459320,"uuid":"592770110","full_name":"MathurUtkarsh/MLOps-with-GitHub-Actions-and-AML","owner":"MathurUtkarsh","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-24T13:55:46.000Z","size":225,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T02:41:42.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MathurUtkarsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2023-01-24T13:55:44.000Z","updated_at":"2023-01-24T17:01:04.000Z","dependencies_parsed_at":"2023-02-13T22:00:37.247Z","dependency_job_id":null,"html_url":"https://github.com/MathurUtkarsh/MLOps-with-GitHub-Actions-and-AML","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"Azure/aml-template","purl":"pkg:github/MathurUtkarsh/MLOps-with-GitHub-Actions-and-AML","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathurUtkarsh%2FMLOps-with-GitHub-Actions-and-AML","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathurUtkarsh%2FMLOps-with-GitHub-Actions-and-AML/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathurUtkarsh%2FMLOps-with-GitHub-Actions-and-AML/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathurUtkarsh%2FMLOps-with-GitHub-Actions-and-AML/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MathurUtkarsh","download_url":"https://codeload.github.com/MathurUtkarsh/MLOps-with-GitHub-Actions-and-AML/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathurUtkarsh%2FMLOps-with-GitHub-Actions-and-AML/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261414527,"owners_count":23154890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-30T02:07:52.856Z","updated_at":"2025-10-07T20:18:00.850Z","avatar_url":"https://github.com/MathurUtkarsh.png","language":"Python","readme":"# ML Ops with GitHub Actions and AML\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"docs/images/aml.png\" height=\"80\"/\u003e\r\n  \u003cimg src=\"https://i.ya-webdesign.com/images/a-plus-png-2.png\" alt=\"plus\" height=\"40\"/\u003e\r\n  \u003cimg src=\"docs/images/actions.png\" alt=\"Azure Machine Learning + Actions\" height=\"80\"/\u003e\r\n\u003c/p\u003e\r\n\r\nThis template shows the more extensive capabilities of using [GitHub Actions](https://github.com/features/actions) with [Azure Machine Learning](https://docs.microsoft.com/en-us/azure/machine-learning/) managing a machine learning project with automated training and deployment. For a more simplified version of this automated pipeline, see the [ml-template-azure](https://github.com/machine-learning-apps/ml-template-azure) repository. \r\n\r\n# Getting started\r\n\r\n### 1. Prerequisites\r\n\r\nThe following prerequisites are required to make this repository work:\r\n- Azure subscription\r\n- Contributor access to the Azure subscription\r\n- Access to [GitHub Actions](https://github.com/features/actions)\r\n\r\nIf you don’t have an Azure subscription, create a free account before you begin. Try the [free or paid version of Azure Machine Learning](https://aka.ms/AMLFree) today.\r\n\r\n### 2. Create repository\r\n\r\nTo get started with ML Ops, simply create a new repo based off this template, by clicking on the green \"Use this template\" button:\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"https://help.github.com/assets/images/help/repository/use-this-template-button.png\" alt=\"GitHub Template repository\" width=\"700\"/\u003e\r\n\u003c/p\u003e\r\n\r\n### 3. Setting up the required secrets\r\n\r\nA service principal needs to be generated for authentication and getting access to your Azure subscription. We suggest adding a service principal with contributor rights to a new resource group or to the one where you have deployed your existing Azure Machine Learning workspace. Just go to the Azure Portal to find the details of your resource group or workspace. Then start the Cloud CLI or install the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) on your computer and execute the following command to generate the required credentials:\r\n\r\n```sh\r\n# Replace {service-principal-name}, {subscription-id} and {resource-group} with your \r\n# Azure subscription id and resource group name and any name for your service principle\r\naz ad sp create-for-rbac --name {service-principal-name} \\\r\n                         --role contributor \\\r\n                         --scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \\\r\n                         --sdk-auth\r\n```\r\n\r\nThis will generate the following JSON output:\r\n\r\n```sh\r\n{\r\n  \"clientId\": \"\u003cGUID\u003e\",\r\n  \"clientSecret\": \"\u003cGUID\u003e\",\r\n  \"subscriptionId\": \"\u003cGUID\u003e\",\r\n  \"tenantId\": \"\u003cGUID\u003e\",\r\n  (...)\r\n}\r\n```\r\n\r\nAdd this JSON output as [a secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets) with the name `AZURE_CREDENTIALS` in your GitHub repository:\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"docs/images/secrets.png\" alt=\"GitHub Template repository\" width=\"700\"/\u003e\r\n\u003c/p\u003e\r\n\r\nTo do so, click on the Settings tab in your repository, then click on Secrets and finally add the new secret with the name `AZURE_CREDENTIALS` to your repository.\r\n\r\nPlease follow [this link](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#creating-encrypted-secrets) for more details. \r\n\r\n### 4. Define your workspace parameters\r\n\r\nYou have to modify the parameters in the \u003ca href=\"/.cloud/.azure/workspace.json\"\u003e`/.cloud/.azure/workspace.json\"` file\u003c/a\u003e in your repository, so that the GitHub Actions create or connect to the desired Azure Machine Learning workspace. Just click on the link and edit the file.\r\n\r\nPlease use the same value for the `resource_group` parameter that you have used when generating the azure credentials. If you already have an Azure ML Workspace under that resource group, change the `name` parameter in the JSON file to the name of your workspace, if you want the Action to create a new workspace in that resource group, pick a name for your new workspace, and assign it to the `name` parameter. You can also delete the `name` parameter, if you want the action to use the default value, which is the repository name. Additionally, if the workspace doesn't exist you will need to enable the `create_workspace` property (set it to `true`) in the same file.\r\n\r\nOnce you save your changes to the file, the predefined GitHub workflow that trains and deploys a model on Azure Machine Learning gets triggered. Check the actions tab to view if your actions have successfully run.\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"docs/images/actions_tab.png\" alt=\"GitHub Actions Tab\" width=\"700\"/\u003e\r\n\u003c/p\u003e\r\n\r\n### 5. Modify the code\r\n\r\nNow you can start modifying the code in the \u003ca href=\"/code\"\u003e`code` folder\u003c/a\u003e, so that your model and not the provided sample model gets trained on Azure. Where required, modify the environment yaml so that the training and deployment environments will have the correct packages installed in the conda environment for your training and deployment.\r\nUpon pushing the changes, actions will kick off your training and deployment run. Check the actions tab to view if your actions have successfully run.\r\n\r\nComment lines 39 to 55 in your \u003ca href=\"/.github/workflows/train_deploy.yml\"\u003e`\"/.github/workflows/train_deploy.yml\"` file\u003c/a\u003e if you only want to train the model. Uncomment line 7 to 8, if you only want to kick off the workflow when pushing changes to the `\"/code/\"` file.\r\n\r\n### 6. Viewing your AML resources and runs\r\n\r\nThe log outputs of your action will provide URLs for you to view the resources that have been created in AML. Alternatively, you can visit the [Machine Learning Studio](https://ml.azure.com/) to view the progress of your runs, etc. For more details, read the documentation below.\r\n\r\n# Documentation\r\n\r\n## Code structure\r\n\r\n| File/folder                   | Description                                |\r\n| ----------------------------- | ------------------------------------------ |\r\n| `code`                        | Sample data science source code that will be submitted to Azure Machine Learning to train and deploy machine learning models. |\r\n| `code/train`                  | Sample code that is required for training a model on Azure Machine Learning. |\r\n| `code/train/train.py`         | Training script that gets executed on a cluster on Azure Machine Learning. |\r\n| `code/train/environment.yml`  | Conda environment specification, which describes the dependencies of `train.py`. These packages will be installed inside a Docker image on the Azure Machine Learning compute cluster, when executing your `train.py`. |\r\n| `code/train/run_config.yml`   | YAML files, which describes the execution of your training run on Azure Machine Learning. This file also references your `environment.yml`. Please look at the comments in the file for more details. |\r\n| `code/deploy`                 | Sample code that is required for deploying a model on Azure Machine Learning. |\r\n| `code/deploy/score.py`        | Inference script that is used to build a Docker image and that gets executed within the container when you send data to the deployed model on Azure Machine Learning. |\r\n| `code/deploy/environment.yml` | Conda environment specification, which describes the dependencies of `score.py`. These packages will be installed inside the Docker image that will be used for deploying your model. |\r\n| `code/test/test.py`           | Test script that can be used for testing your deployed webservice. Add a `deploy.json` to the `.cloud/.azure` folder and add the following code `{ \"test_enabled\": true }` to enable tests of your webservice. Change the code according to the tests that zou would like to execute. |\r\n| `.cloud/.azure`               | Configuration files for the Azure Machine Learning GitHub Actions. Please visit the repositories of the respective actions and read the documentation for more details. |\r\n| `.github/workflows`           | Folder for GitHub workflows. The `train_deploy.yml` sample workflow shows you how your can use the Azure Machine Learning GitHub Actions to automate the machine learning process. |\r\n| `docs`                        | Resources for this README.                 |\r\n| `CODE_OF_CONDUCT.md`          | Microsoft Open Source Code of Conduct.     |\r\n| `LICENSE`                     | The license for the sample.                |\r\n| `README.md`                   | This README file.                          |\r\n| `SECURITY.md`                 | Microsoft Security README.                 |\r\n\r\n## Documentation of Azure Machine Learning GitHub Actions\r\n\r\nThe template uses the open source Azure certified Actions listed below. Click on the links and read the README files for more details.\r\n- [aml-workspace](https://github.com/Azure/aml-workspace) - Connects to or creates a new workspace\r\n- [aml-compute](https://github.com/Azure/aml-compute) - Connects to or creates a new compute target in Azure Machine Learning\r\n- [aml-run](https://github.com/Azure/aml-run) - Submits a ScriptRun, an Estimator or a Pipeline to Azure Machine Learning\r\n- [aml-registermodel](https://github.com/Azure/aml-registermodel) - Registers a model to Azure Machine Learning\r\n- [aml-deploy](https://github.com/Azure/aml-deploy) - Deploys a model and creates an endpoint for the model\r\n\r\n## Known issues\r\n\r\n### Error: MissingSubscriptionRegistration\r\n\r\nError message: \r\n```sh\r\nMessage: ***'error': ***'code': 'MissingSubscriptionRegistration', 'message': \"The subscription is not registered to use namespace 'Microsoft.KeyVault'. See https://aka.ms/rps-not-found for how to register subscriptions.\", 'details': [***'code': 'MissingSubscriptionRegistration', 'target': 'Microsoft.KeyVault', 'message': \"The subscription is not registered to use namespace 'Microsoft.KeyVault'. See https://aka.ms/rps-not-found for how to register subscriptions\r\n```\r\nSolution:\r\n\r\nThis error message appears, in case the `Azure/aml-workspace` action tries to create a new Azure Machine Learning workspace in your resource group and you have never deployed a Key Vault in the subscription before. We recommend to create an Azure Machine Learning workspace manually in the Azure Portal. Follow the [steps on this website](https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-1st-experiment-sdk-setup#create-a-workspace) to create a new workspace with the desired name. After ou have successfully completed the steps, you have to make sure, that your Service Principal has access to the resource group and that the details in your \u003ca href=\"/.cloud/.azure/workspace.json\"\u003e`/.cloud/.azure/workspace.json\"` file\u003c/a\u003e are correct and point to the right workspace and resource group.\r\n\r\n# What is MLOps?\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"docs/images/ml-lifecycle.png\" alt=\"Azure Machine Learning Lifecycle\" width=\"700\"/\u003e\r\n\u003c/p\u003e\r\n\r\nMLOps empowers data scientists and machine learning engineers to bring together their knowledge and skills to simplify the process of going from model development to release/deployment. ML Ops enables you to track, version, test, certify and reuse assets in every part of the machine learning lifecycle and provides orchestration services to streamline managing this lifecycle. This allows practitioners to automate the end to end machine Learning lifecycle to frequently update models, test new models, and continuously roll out new ML models alongside your other applications and services.\r\n\r\nThis repository enables Data Scientists to focus on the training and deployment code of their machine learning project (`code` folder of this repository). Once new code is checked into the `code` folder of the master branch of this repository the GitHub workflow is triggered and open source Azure Machine Learning actions are used to automatically manage the training through to deployment phases.\r\n\r\n# Contributing\r\n\r\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\r\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\r\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\r\n\r\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\r\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\r\nprovided by the bot. You will only need to do this once across all repos using our CLA.\r\n\r\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\r\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\r\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\r\n\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathurutkarsh%2Fmlops-with-github-actions-and-aml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathurutkarsh%2Fmlops-with-github-actions-and-aml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathurutkarsh%2Fmlops-with-github-actions-and-aml/lists"}