1 h 15 (S3.1 : 15 min · S3.2 : 30 min · S3.3 : 30 min)
modules 1 and 2, reading Bash or PowerShell scripts
governed rg-stNN-* groups (M2 tags, policies and RBAC), rg-stNN-shared still empty
--query) and Az PowerShell (pipeline)what-if check, reproducibly15 min
ARM = Single REST API + Entra ID authentication + RBAC and Policy checksMicrosoft.Compute, Microsoft.Network)flowchart LR P[Portal] --> ARM[Azure Resource Manager] C[Azure CLI] --> ARM PS[Az PowerShell] --> ARM T[ARM JSON / Bicep] --> ARM ARM --> RP1[Microsoft.Compute] ARM --> RP2[Microsoft.Network] ARM --> RP3[Microsoft.Storage]
management.azure.com (create a storage account)Contributor (control) ≠ Storage Blob Data Contributor (data)Arvéo: Owner of rg-st07-data → storage account creation allowed
Arvéo: no "data" role → blob read denied through Entra ID (access key excepted)
group Owner ≠ data access; the data role is assigned separately (M6)
Management group > Subscription > Resource group > ResourceResource ID:
/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/rg-st07-shared
/providers/Microsoft.OperationalInsights/workspaces/log-st07-sharedget an ID with --query id -o tsv rather than copying it by hand
Type = Provider/resourceType (Microsoft.Storage/storageAccounts)*/register/action)2023-05-01), visible in templatesaz provider show --namespace Microsoft.OperationalInsights \
--query registrationState -o tsvExpected output:
RegisteredMissingSubscriptionRegistration → provider not registered; registration reserved to the trainer
Cloud Shell = Temporary Linux container + az + Az + bicep + kubectl + gitpwsh from Bash, bash from PowerShell)code file.bicepclouddrive)Arvéo picks the ephemeral session; scripts versioned in Git, nothing critical in the container
ephemeral session = files lost on close; download deliverables
| Tool | Strength | Typical use |
|---|---|---|
| Portal | Discovery, visual | Exploration, one-off diagnosis |
| Azure CLI | Concise, JSON output | Bash scripts, CI/CD pipelines |
| Az PowerShell | .NET objects, pipeline | Windows automation, reports |
| ARM JSON template | Native ARM format | Reading, export, legacy templates |
| Bicep | Readable, modular | Reference IaC for Azure |
portal to understand, code to reproduce
[TO VERIFY])800 deployments max per resource group, oldest ones purged automatically
30 min
az <group> [<subgroup>] <action> --parameter valuegroup, vm, network vnet, storage account, monitorcreate, list, show, update, delete-o formats: json (default), jsonc, table, tsv, yaml, noneaz vm create --help; search: az find "storage account"az group list -o tableExpected output (excerpt, all trainees' groups visible with Reader):
Name Location Status
-------------- ------------- ---------
rg-st07-app francecentral Succeeded
rg-st07-shared francecentral SucceededVariables: <NN> = two-digit trainee number
az account show --query "{Account:user.name, Subscription:name}" -o table
az configure --defaults group=rg-st<NN>-shared location=francecentral
az configure --list-defaults -o tableExpected output (last command, trainee 07):
Name Source Value
-------- --------------------------------- --------------
group /home/<USERNAME>/.azure/config rg-st07-shared
location /home/<USERNAME>/.azure/config francecentraldefaults = shorter commands; check them before any deletion
[?condition].{Alias:field} (filter + projection)az resource list --resource-group rg-st07-shared \
--query "[].{Name:name, Type:type, Owner:tags.Proprietaire}" -o table
WS_ID=$(az monitor log-analytics workspace show -n log-st07-shared \
--query customerId -o tsv)Expected output:
Name Type Owner
--------------- ---------------------------------------- -----
log-st07-shared Microsoft.OperationalInsights/workspaces st07-o tsv + $( ): raw value reusable in a variable[?starts_with(name, 'rg-st07-')]: filter on a prefixVerb-AzNoun -Parameter value (Get, New, Set, Update, Remove)Az.Accounts, Az.Resources, Az.Storage, Az.NetworkGet-AzContext, Set-AzContext -Subscription <SUBSCRIPTION_ID>Get-Command -Module Az.Storage -Verb New-WhatIf on most New, Set and Remove cmdletsGet-AzResourceGroup | Where-Object ResourceGroupName -like 'rg-st07-*' |
Select-Object ResourceGroupName, LocationExpected output (excerpt):
ResourceGroupName Location
----------------- --------
rg-st07-app francecentral
rg-st07-data francecentralGet-AzResource |
Where-Object ResourceGroupName -like 'rg-st07-*' |
Select-Object Name, ResourceType, ResourceGroupName,
@{ Name = 'Owner'; Expression = { $_.Tags['Proprietaire'] } } |
Export-Csv -Path ./inventory-st07.csv -NoTypeInformation -Encoding utf8
Import-Csv ./inventory-st07.csv | Format-TableExpected output:
Name ResourceType ResourceGroupName Owner
---- ------------ ----------------- -----
log-st07-shared Microsoft.OperationalInsights/workspaces rg-st07-shared st07Select-Object before Export-Csv; a report exports only useful columns
| Operation | Azure CLI | Az PowerShell |
|---|---|---|
| Sign in | az login |
Connect-AzAccount |
| Active subscription | az account set -s <ID> |
Set-AzContext -Subscription <ID> |
| List groups | az group list |
Get-AzResourceGroup |
| Create a group | az group create -n <NAME> |
New-AzResourceGroup -Name <NAME> |
| Merge tags | az tag update --operation Merge |
Update-AzTag -Operation Merge |
different quoting rules; a --query written for Bash often fails in PowerShell
Reliable script = Variables at the top + Stop on error + Idempotenceset -euo pipefail; PowerShell: $ErrorActionPreference = 'Stop'show or Get-Az*, otherwise create or New-Az*)ST=st07 → log-${ST}-shared)Before: portal clicks → forgotten tag → creation denied by Azure Policy
After: versioned script → same result for every trainee, every environment
30 min
IaC = Declarative + Versioned + ReproducibleBefore: 6 groups × N trainees configured by hand → configuration drift
After: one Bicep file + one numero parameter → identical environments
Template = parameters + variables + resources + outputs| Section | Role | Example |
|---|---|---|
$schema, contentVersion |
Format version | 2019-04-01 |
parameters |
Values supplied at deployment | numero, location |
variables |
Computed values | prefix = st07 |
resources |
Resources to deploy | Managed identity |
outputs |
Returned values | principalId |
[format('id-{0}-deploy', variables('prefix'))], [resourceGroup().location]Bicep → az bicep build → ARM JSON → Azure Resource Managerparam numero string
param location string = resourceGroup().location
var prefix = 'st${numero}'
resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'id-${prefix}-deploy'
location: location
}
output principalId string = identity.properties.principalIdno state file; the reference = Azure itself (difference with Terraform)
@description('Two-digit trainee number')
@minLength(2)
@maxLength(2)
param numero string
@allowed([ 'francecentral', 'westeurope' ])
param location string = 'francecentral'
@secure()
param adminPassword string@allowed, @minLength, @maxLength)@secure(): value masked in deployment history and logsexisting: reference an existing resource without redeploying it.bicepparam file: per-environment values, outside the templatewhat-if before create, every timeVariables: <NN> = two-digit trainee number
az deployment group what-if --resource-group rg-st<NN>-shared \
--template-file socle.bicep --parameters numero=<NN>
az deployment group create --resource-group rg-st<NN>-shared \
--template-file socle.bicep --parameters numero=<NN>Expected output (what-if, last line):
Resource changes: 1 to create, 2 no change.+ create · ~ modify · - delete · = no change · * ignorePowerShell equivalent New-AzResourceGroupDeployment -TemplateFile socle.bicep -WhatIf
| Mode | Resources missing from the template | Use |
|---|---|---|
| Incremental (default) | Kept | General case |
| Complete | Deleted from the group | Group 100 % managed as IaC |
az bicep decompile --file template.json: ARM JSON → Bicep (best-effort conversion)az group export (starting point, to clean up)module network './network.bicep' + parameters → reusable splitComplete mode on rg-stNN-shared = deletion of everything not in the file
--query + -o tsv for scripting; PowerShell: objects + pipeline for reportswhat-if before every deployment; Incremental mode by defaultMicrosoft.Resources provider onlyrg-st07-data, a trainee cannot read blobs through Entra ID. Why?Microsoft.Storage provider is not registeredaz group show -n rg-st07-shared -o jsonaz group show -n rg-st07-shared -o tableaz group list --query idaz group show -n rg-st07-shared --query id -o tsvaz deployment group what-if do?@description@allowed@metadata@secure()MissingSubscriptionRegistration error when creating a resource: what action?