I’m starting with AI, I need to create a pipeline that will create an ML Workspace, all basic components, an EndPoint with one or two Models. The pipeline must be able to clean everything on the evening and recreate everything in the morning.
I was able to create one EndPoint and one Model from Azure AI Studio so I know I have sufficient access to do it but from my pipeline, I get errors trying to clean and errors when trying to build.
Could you please help me understand how to build this, if possible at all ?
Here is my code running on a Microsoft hosted VM:
Running an empty bicep file with –mode Complete to delete everything in a resource group, I know there are better ways but this should be good to test the pipeline at first
pool:
vmImage: 'ubuntu-latest'
jobs:
- job: RunEmptyBicep
steps:
- task: AzureCLI@2
name: RunEmptyBicep
inputs:
azureSubscription: $(azureServiceConnection)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment group create --mode Complete --resource-group $(resourceGroupName) --template-file empty.bicep
I noticed that even with –mode Complete above, keyvault and workspace could stay so I use this purge them both
- job: PurgeResources
steps:
- task: AzureCLI@2
name: PurgeResources
inputs:
azureSubscription: $(azureServiceConnection)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az extension add -n ml -y
az ml workspace delete --name $(workspaceName) --resource-group $(resourceGroupName) --all-resources --permanently-delete --yes
az keyvault purge --name $(keyVaultName)
Run a BICEP file to create basic resources and the workspace, if I use the same workspace name twice, I get an error saying it still there and needs purge even if I tried to purge it above
- job: RunCommonBicep
steps:
- task: AzureCLI@2
name: RunCommonBicep
inputs:
azureSubscription: $(azureServiceConnection)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az deployment group create --resource-group $(resourceGroupName) --template-file common.bicep --parameters storageAccountName=$(storageAccountName) keyVaultName=$(keyVaultName) applicationInsightsName=$(applicationInsightsName) containerRegistryName=$(containerRegistryName) workspaceName=$(workspaceName)
Use ML commands to build ML EndPoint and Models
- job: CreateMachineLearningEndPoint
steps:
- task: AzureCLI@2
name: CreateMachineLearningEndPoint
inputs:
azureSubscription: $(azureServiceConnection)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az extension add -n ml -y
az ml online-endpoint create --file ./create_or_update_endpoint.yml --resource-group $(resourceGroupName) --workspace-name $(workspaceName)
az ml online-deployment create -f ./deploy_model_to_endpoint.yml --resource-group $(resourceGroupName) --workspace-name $(workspaceName)
When running the last task, I have errors saying that I don’t have enough credits to do that, is there a recommended approach to find what I can request ? I wanted to use the same settings as the ones I created from Azure AI Studio but I don’t find how to fill “create_or_update_endpoint.yml” and “deploy_model_to_endpoint.yml” with the correct values to use. I just need something simple for start.
Here are my the three other files for now:
common.bicep:
param location string = resourceGroup().location
param storageAccountName string
param keyVaultName string
param applicationInsightsName string
param containerRegistryName string
param workspaceName string
var tenantId = subscription().tenantId
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: storageAccountName
location: location
sku: {
name: 'Standard_RAGRS'
}
kind: 'StorageV2'
properties: {
encryption: {
services: {
blob: {
enabled: true
}
file: {
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
supportsHttpsTrafficOnly: true
minimumTlsVersion: 'TLS1_2'
allowBlobPublicAccess: false
networkAcls: {
defaultAction: 'Deny'
}
}
}
var storageAccountId = storageAccount.id
resource vault 'Microsoft.KeyVault/vaults@2022-07-01' = {
name: keyVaultName
location: location
properties: {
tenantId: tenantId
sku: {
name: 'standard'
family: 'A'
}
accessPolicies: []
enableSoftDelete: true
}
}
var keyVaultId = vault.id
resource applicationInsight 'Microsoft.Insights/components@2020-02-02' = {
name: applicationInsightsName
location: location
kind: 'web'
properties: {
Application_Type: 'web'
}
}
var applicationInsightId = applicationInsight.id
resource registry 'Microsoft.ContainerRegistry/registries@2022-02-01-preview' = {
name: containerRegistryName
sku: {
name: 'Standard'
}
location: location
properties: {
adminUserEnabled: false
}
}
var containerRegistryId = registry.id
resource workspace 'Microsoft.MachineLearningServices/workspaces@2022-10-01' = {
name: workspaceName
identity: {
type: 'SystemAssigned'
}
location: location
properties: {
friendlyName: workspaceName
storageAccount: storageAccountId
keyVault: keyVaultId
applicationInsights: applicationInsightId
containerRegistry: containerRegistryId
}
}
create_or_update_endpoint.yml
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineEndpoint.schema.json
name: 'my-dev-endpoint'
deploy_model_to_endpoint.yml
$schema: https://azuremlschemas.azureedge.net/latest/managedOnlineDeployment.schema.json
name: my-dev-deployment
endpoint_name: my-dev-endpoint
model: azureml://registries/azureml/models/t5-base/versions/17
instance_type: Standard_NC12s_v3
instance_count: 1
type: "managed"
Thanks for any help.