This guide provides step-by-step instructions to get started with azure-init for both development and usage scenarios.
- An Azure subscription
- A Linux VM running in Azure
Azure-init typically needs to be pre-installed and configured in Linux VM images that are Azure-optimized, since the agent is not currently run on Azure Linux VMs by default. At the moment, adding azure-init to a Linux image requires following the process found in the SIG image testing guide. If you're using such an image, azure-init will automatically run during the boot process and handle VM initialization.
To check that azure-init is working properly on your VM:
- Connect to your SIG VM via SSH
- Check the azure-init service status:
sudo systemctl status azure-init- Review the logs:
sudo journalctl -u azure-init- Create or edit the configuration file:
sudo mkdir -p /etc/azure-init
sudo nano /etc/azure-init/azure-init.toml- Add your configuration settings (example):
[ssh]
authorized_keys_path = "/home/azureuser/.ssh/authorized_keys"
query_sshd_config = true
[imds]
connection_timeout_secs = 5.0- Restart the service:
sudo systemctl restart azure-init- Install Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env- Fork and Clone the Repository:
git clone https://github.com/{your-fork}/azure-init.git
cd azure-init- Install dependencies:
For Debian/Ubuntu:
sudo apt-get update
sudo apt-get install -y build-essential pkg-config libudev-devFor RHEL/Fedora:
sudo dnf install -y gcc pkg-config systemd-develBuild all components:
cargo build --allOr just the main binary:
cargo build --bin azure-initRun the unit tests:
cargo test --verbose --all-features --workspace- Make code changes
- Build and test locally:
cargo build
cargo test- Test with a local configuration:
Warning: Avoid running the azure-init binary locally, as this runs the risk of modifying your local system.
To test your changes, it is highly advised to use the E2E Testing Guide.
If these changes are part of a PR to the main Azure-Init repo, the CI pipeline will run a mock IMDS server and the azure-init binary in two separate Docker containers. Both containers will output all logs they have access to in order to better debug where failures are taking place.
- Review the Configuration Guide for detailed configuration options
- Understand the Tracing System for monitoring and debugging
- Explore End-to-End Testing for comprehensive testing