Date: 2026-05-11
Time: 15:18
I'll create a summary entry for this Azure examples documentation.
This page covers how to use FTL2 to provision and manage Azure cloud infrastructure by leveraging the azure.azcollection Ansible collection. It demonstrates setup, credential configuration, and a web stack example that provisions a complete Linux VM environment with networking and web server configuration.
AZURECLIENTID, AZURESECRET, AZURESUBSCRIPTIONID, AZURETENANT)ansible-galaxy collection install azure.azcollection — FTL2 reuses Ansible collections but calls them differentlyawait ftl.azure.azcollection.azurermvirtualmachine(...).ftl2-state-azure.json to track provisioned resources for idempotencyftl.add_host()--check flag) enables dry runs before actual provisioning--teardown flag to destroy provisioned resources
# Install the Azure collection
ansible-galaxy collection install azure.azcollection
# Set Azure service principal credentials
export AZURE_CLIENT_ID="your-client-id"
export AZURE_SECRET="your-client-secret"
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
export AZURE_TENANT="your-tenant-id"
# Set SSH public key for VM access
export AZURE_VM_SSH_PUBKEY="ssh-rsa AAAA..."
# Run examples (all use `uv run python`)
uv run python example_azure_web_stack.py --check # Dry run
uv run python example_azure_web_stack.py # Provision
uv run python example_azure_web_stack.py --teardown # Destroy
Module call syntax (Python-native):
await ftl.azure.azcollection.azure_rm_virtualmachine(...)
Error handling:
ftl.failed — boolean check for failuresftl.errors — programmatic access to error detailsazure.azcollection) but invokes them in-process rather than via subprocess.ftl2-state-azure.json file connects to FTL2's broader state tracking and crash recovery system--check flag is consistent with FTL2's general dry-run capability across all providersftl.add_host(): Connects provisioning to inventory management — dynamically adding newly created VMs as hosts for subsequent configuration tasksawait ftl.<namespace>.<collection>.<module>(...) pattern applies to all Ansible collections, not just Azure.ftl2-state-azure.jsonazure.azcollection.<module_name>ftl.add_host() enables provision-then-configure workflows in a single script--check (dry run), --teardown (destroy)ftl.failed and ftl.errors — not exceptions by defaultuv run python — FTL2 uses uv as its Python runner