Azure Machine Learning with IaC
Exploring Azure Machine Learning with Infrastructure as Code and CI/CD
Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. In a Bicep file, you define the infrastructure you want to deploy to Azure, and then use that file throughout the development lifecycle to repeatedly deploy your infrastructure. Your resources are deployed in a consistent manner. (source)
Prerequisites
To automate this process we will need to create the following services:
- Azure Subscription
- Resource Group
- Storage Account Name and Container registry
- VNet and SubNet
- Key Vault
- Application Insight
- Machine Learning Workspace
Using Bicep to create Resource Group, Azure ML workspaces.
Login to your Azure subscription:
# connect with your created credentials
az login --use-device-code
and create a resource group:
az group create --name TomazKWML --location westeurope
And following the creation of Resource group, continue with creation of Bicep resources:
resource storageAccountName_resource 'Microsoft.Storage/storageAccounts@2019-04-01' = if (enablePE && (storageAccountOption == 'new')) {
name: storageAccountName
tags: tagValues
location: storageAccountLocation
sku: {
name: storageAccountType
}
kind: 'StorageV2'
properties: {
encryption: {
services: {
blob: {
enabled: true
}
file: {
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
supportsHttpsTrafficOnly: true
networkAcls: ((storageAccountBehindVNet == 'true') ? networkRuleSetBehindVNet : json('null'))
isHnsEnabled: storageAccountHnsEnabled
}
}
Complete Code is available in this repository with:
templateMLWS.bicep
as main bicep filenested_UpdateSubnetPolicy_vnetName_subnetName.bicep
as module for SubnetPolicynested_privateEndpointDeploymentName.bicep
as module for privateEndpoint
With all three files set, run the command to deploy the resouces:
az deployment group create --resource-group TomazKWML --template-file ./templateMLWS.bicep
Visualisation of Bicep dependencies
Cloning the repository
You can follow the steps below to clone the repository.
sudo git clone https://github.com/tomaztk/AzureML-with-IaC.git
Contact
Get in contact if you would like to contribute or simply fork a repository and alter the code.
Contributing
Do the usual GitHub fork and pull request dance. Add yourself (or I will add you to the contributors section) if you want to.