05 - Infrastructure as Code (Premium)¶
Define your Premium (EP1) PowerShell app in Bicep for reproducible deployments.
Bicep Template¶
param appName string
param location string = resourceGroup().location
param storageName string
resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: storageName
location: location
sku: { name: 'Standard_LRS' }
kind: 'StorageV2'
}
resource app 'Microsoft.Web/sites@2023-12-01' = {
name: appName
location: location
kind: 'functionapp,linux'
properties: {
siteConfig: {
appSettings: [
{ name: 'FUNCTIONS_EXTENSION_VERSION', value: '~4' }
{ name: 'FUNCTIONS_WORKER_RUNTIME', value: 'powershell' }
{ name: 'FUNCTIONS_WORKER_RUNTIME_VERSION', value: '7.4' }
]
}
}
}
Deploy¶
az deployment group create \
--resource-group $RG \
--template-file infra/main.bicep \
--parameters appName=$APP_NAME storageName=$STORAGE_NAME
az deployment group create | Deploy the Bicep template to the resource group. | | --resource-group | Target resource group for the deployment. | | --template-file | Path to the Bicep template. | | --parameters | Template parameter values. | Verification¶
| Command/Parameter | Purpose | | --- | --- | |az deployment group show | Show the status of a completed deployment. | | --resource-group | Resource group that contains the deployment. | | --name | Name of the deployment. | | --query | JMESPath query selecting the provisioning state. | Returns Succeeded.
Next Steps¶
Automate the build and deploy with CI/CD.
Next: 06 - CI/CD
See Also¶
- Tutorial Overview & Plan Chooser
- PowerShell Language Guide
- Platform: Hosting Plans
- Operations: Deployment
- Recipes Index