azure-image-builder
This skill uses Packer's Azure ARM builder to create custom managed images and Compute Gallery images in Azure.
Identity proven by GitHub's verified organisation badge (hashicorp)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- AGPL-3.0 (copyleft)
- Pin
- f706481pinned Oct 9, 2026
- Context cost
- about 1,000 tokenswhen the skill loads
- GitHub stars
- 890on hashicorp/agent-skills
- Scripts
- None found
What it does
“Build Azure managed images and Azure Compute Gallery images with Packer. Use when creating custom images for Azure VMs.”
Generated summary from the skill's own text
This skill uses Packer's Azure ARM builder to create custom managed images and Compute Gallery images in Azure. It configures authentication with service principals or managed identity, defines base OS sources, and provisions images with shell commands. Building images typically takes 15-45 minutes and incurs Azure compute and storage costs.
When to use it
- Creating custom Azure VM images with specific software or configurations
- Distributing images across multiple Azure regions via Compute Gallery
- Building images from Ubuntu or other Azure Marketplace base images
- Automating image creation as part of infrastructure-as-code workflows
When not to
- Building images for on-premises or other cloud providers
- When baseline Azure Marketplace images meet all requirements without customization
- Quick one-off VM deployments where image reuse is not needed
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add hashicorp/agent-skills --skill azure-image-builderInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install hashicorp/agent-skills azure-image-builder@f706481af9b8fedb66de909f6243ad29601afa0cInstalls the commit we checked (f706481).
Copy by hand
Download the folder at f706481 and put it in .claude/skills/azure-image-builder for Claude Code and in .agents/skills/azure-image-builder for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "azure-image-builder" by HashiCorp. Source, pinned to commit f706481af9b8fedb66de909f6243ad29601afa0c: https://github.com/hashicorp/agent-skills/tree/f706481af9b8fedb66de909f6243ad29601afa0c/plugins/packer/skills/azure-image-builder 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/azure-image-builder/ for Claude Code and .agents/skills/azure-image-builder/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/hashicorp/azure-image-builder
SKILL.md at the pin
---
name: azure-image-builder
description: Build Azure managed images and Azure Compute Gallery images with Packer. Use when creating custom images for Azure VMs.
metadata:
lifecycle-status: active
---
# Azure Image Builder
Build Azure managed images and Azure Compute Gallery images using Packer's `azure-arm` builder.
**Reference:** [Azure ARM Builder](https://developer.hashicorp.com/packer/integrations/hashicorp/azure/latest/components/builder/arm)
> **Note:** Building Azure images incurs costs (compute, storage, data transfer). Builds typically take 15-45 minutes depending on provisioning and OS.
## Basic Managed Image
```hcl
packer {
required_plugins {
azure = {
source = "github.com/hashicorp/azure"
version = "~> 2.0"
}
}
}
variable "client_id" {
type = string
sensitive = true
}
variable "client_secret" {
type = string
sensitive = true
}
variable "subscription_id" {
type = string
}
variable "tenant_id" {
type = string
}
variable "resource_group" {
type = string
default = "packer-images-rg"
}
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
}
source "azure-arm" "ubuntu" {
client_id = var.client_id
client_secret = var.client_secret
subscription_id = var.subscription_id
tenant_id = var.tenant_id
managed_image_resource_group_name = var.resource_group
managed_image_name = "my-app-${local.timestamp}"
os_type = "Linux"
image_publisher = "Canonical"
image_offer = "0001-com-ubuntu-server-jammy"
image_sku = "22_04-lts-gen2"
location = "East US"
vm_size = "Standard_B2s"
azure_tags = {
Name = "my-app"
BuildDate = local.timestamp
}
}
build {
sources = ["source.azure-arm.ubuntu"]
provisioner "shell" {
inline = [
"sudo apt-get update",
"sudo apt-get upgrade -y",
]
}
}
```
## Azure Compute Gallery
```hcl
source "azure-arm" "ubuntu" {
client_id = var.client_id
client_secret = var.client_secret
subscription_id = var.subscription_id
tenant_id = var.tenant_id
os_type = "Linux"
image_publisher = "Canonical"
image_offer = "0001-com-ubuntu-server-jammy"
image_sku = "22_04-lts-gen2"
location = "East US"
vm_size = "Standard_B2s"
shared_image_gallery_destination {
resource_group = "gallery-rg"
gallery_name = "myImageGallery"
image_name = "ubuntu-webapp"
image_version = "1.0.${formatdate("YYYYMMDD", timestamp())}"
replication_regions = ["East US", "West US 2"]
storage_account_type = "Standard_LRS"
}
}
```
## Authentication
### Service Principal
```bash
# Create service principal
az ad sp create-for-rbac \
--name "packer-sp" \
--role Contributor \
--scopes /subscriptions/<subscription-id>
# Set environment variables
export ARM_CLIENT_ID="<client-id>"
export ARM_CLIENT_SECRET="<client-secret>"
export ARM_SUBSCRIPTION_ID="<subscription-id>"
export ARM_TENANT_ID="<tenant-id>"
```
### Managed Identity
```hcl
source "azure-arm" "ubuntu" {
use_azure_cli_auth = true
subscription_id = var.subscription_id
# ... rest of configuration
}
```
## Build Commands
```bash
# Set authentication
export ARM_CLIENT_ID="your-client-id"
export ARM_CLIENT_SECRET="your-client-secret"
export ARM_SUBSCRIPTION_ID="your-subscription-id"
export ARM_TENANT_ID="your-tenant-id"
# Initialize plugins
packer init .
# Validate template
packer validate .
# Build image
packer build .
```
## Common Issues
**Authentication Failed**
- Verify service principal credentials
- Ensure Contributor role on resource group
- Check subscription and tenant IDs
**Compute Gallery Version Exists**
- Image versions are immutable
- Use unique version numbers with date/build number
- Cannot overwrite existing versions
**Timeout During Provisioning**
- Check network connectivity from build VM
- Verify NSG rules allow required traffic
- Increase timeout if needed
## References
- [Azure ARM Builder](https://developer.hashicorp.com/packer/integrations/hashicorp/azure/latest/components/builder/arm)
- [Azure Compute Gallery](https://learn.microsoft.com/en-us/azure/virtual-machines/azure-compute-gallery)
From hashicorp/agent-skills at f706481, shown as plain text under its license: AGPL-3.0 (copyleft). The license text is in LICENSE.
View SKILL.md on GitHub at f706481Files
- SKILL.md4.2 KB · 1badb5146eee
1 file, 4.2 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at f706481More from HashiCorp
aws-ami-builder
This skill enables the agent to build custom Amazon Machine Images using Packer's amazon-ebs builder.
Claude Code, Codex, Cursor +4 · about 870 tokens · pinned 6 days ago
azure-verified-modules
This skill provides comprehensive requirements and best practices for developing Azure Terraform modules that meet Azure Verified Modules (AVM) certification…
Claude Code, Codex, Cursor +4 · about 4K tokens · pinned 6 days ago
new-terraform-provider
Scaffolds a new Terraform provider using the Plugin Framework by creating workspace structure, initializing a Go module, and generating main.go and…
Contains scripts
Claude Code, Codex, Cursor +3 · about 330 tokens · pinned 6 days ago
provider-actions
This skill guides implementing Terraform Actions, imperative operations that execute at provider lifecycle events using the Plugin Framework.
Claude Code, Codex, Cursor +4 · about 4.2K tokens · pinned 6 days ago
provider-configuration
This skill guides implementing Terraform provider authentication using the Plugin Framework, covering provider schema design, credential provider chains that…
Claude Code, Codex, Cursor +4 · about 3.3K tokens · pinned 6 days ago
provider-docs
This skill helps create and maintain Terraform provider documentation for the HashiCorp Registry by writing schema descriptions, templates, and generated docs…
Claude Code, Codex, Cursor +4 · about 880 tokens · pinned 6 days ago
Related in Cloud and DevOps
architect-for-startups
Provides stage-appropriate AWS architecture guidance for startups from pre-revenue through Series B+, considering runway, team size, and AWS credits.
by Amazon (AWS)Official publisher
Claude Code, Codex, Cursor +4 · about 3.4K tokens · pinned 6 days ago
azure-to-aws
This skill guides agents through migrating Azure workloads to AWS across six phases: discovering Azure resources from Terraform, live CLI, app code, and…
by Amazon (AWS)Official publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 4.3K tokens · pinned 6 days ago
gcp-to-aws
Migrates workloads from Google Cloud Platform to AWS, including AI and agentic applications from any provider.
by Amazon (AWS)Official publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 14.3K tokens · pinned 6 days ago
heroku-to-aws
This skill guides migration of applications and databases from Heroku to AWS services like Elastic Beanstalk, RDS, ElastiCache, and MSK.
by Amazon (AWS)Official publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 7K tokens · pinned 6 days ago
prompt-library-for-startups
Provides searchable copy-paste prompts and installable agents for AWS tasks including MVP scaffolding, RAG chatbots with Bedrock, security evaluation, cost…
by Amazon (AWS)Official publisher
Claude Code, Codex, Cursor +4 · about 2.7K tokens · pinned 6 days ago
start-building-for-startups
This skill runs an interactive discovery workflow to understand a user's AWS project goals, constraints, and preferences through picker-based questions, then…
by Amazon (AWS)Official publisher
Claude Code · about 5.9K tokens · pinned 6 days ago