A3 - CLI & bicep

az group create \
  --name rg-ai300-dev \
  --location uksouth
az <group> <subgroup/action> [arguments]
az
└── group
     └── create
az ml workspace ...
az ml job ...
az ml model ...
az ml online-endpoint ...
>>> az login

You
 ↓
Azure CLI
 ↓
Microsoft Entra authentication
 ↓
access token
 ↓
Azure
 ↓
RBAC
 ↓
allowed operation?
# Conceptually

I want:
resource group:
    rg-ai300-dev

storage:
    ai300storage

ML workspace:
    mlw-ai300-dev
    

# Bicep command

resource storage 'Microsoft.Storage/storageAccounts@2025-01-01' = {
	name: 'ai300storage'
	location: 'uksouth'
	
	sku: {
		name: 'Standard_LRS'
	}
	
	kind: 'StorageV2'
}

# Meaning

resource storage
       ├── type = Storage Account
       ├── API version = ...
       ├── name = ai300storage
       ├── location = UK South
       ├── SKU = Standard_LRS
       └── kind = StorageV2
resource storage ... = {
   ...
}

resource workspace ... = {
   ...
   storageAccount: storage.id  # reference = dependency
}
f(f(x))=f(x)
CURRENT

Storage
ML workspace
Key Vault

       +

NEW BICEP

Storage
ML workspace (changed)
Key Vault
Container Registry (new)

       ↓

WHAT-IF

~ modify ML workspace
+ create Container Registry
Pull request
     ↓
validate Bicep
     ↓
run WHAT-IF
     ↓
show expected infrastructure changes
     ↓
human review
     ↓
merge
     ↓
deploy
az deployment group create \
    --resource-group rg-ai300-dev \
    --template-file main.bicep
    
# Meaning

Azure CLI
    ↓
"deploy this Bicep"
    ↓
Azure Resource Manager
    ↓
main.bicep
    ↓
desired infrastructure
    ↓
Azure resources
GitHub repository
      │
      │ push/merge
      ▼
GitHub Actions
      │
      │ authenticate via
      │ workload identity
      ▼
Microsoft Entra
      │
      ▼
Azure RBAC
      │
      ▼
Azure CLI
      │
      ▼
deploy Bicep
      │
      ▼
Azure Resource Manager
      │
      ▼
Azure infrastructure
ai300-project/
│
├── src/
│   ├── train.py
│   └── score.py
│
├── tests/
│
├── ml/
│   ├── train-job.yml
│   └── pipeline.yml
│
├── infra/
│   ├── main.bicep
│   ├── dev.bicepparam
│   └── prod.bicepparam
│
├── .github/
│   └── workflows/
│       ├── ci.yml
│       └── deploy.yml
│
├── Dockerfile
└── requirements.txt