From 37931c551f866c1dc0f7349379870965a5727358 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Wed, 2 Oct 2019 23:52:55 +0000 Subject: [PATCH] add example --- examples/azure/debian-chroot.json | 26 +++++++++++++ .../docs/builders/azure-chroot.html.md.erb | 37 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 examples/azure/debian-chroot.json diff --git a/examples/azure/debian-chroot.json b/examples/azure/debian-chroot.json new file mode 100644 index 000000000..4b29632b1 --- /dev/null +++ b/examples/azure/debian-chroot.json @@ -0,0 +1,26 @@ +{ + "variables": { + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" + }, + "builders": [{ + "type": "azure-chroot", + + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + + "image_resource_id": "/subscriptions/{{user `subscription_id`}}/resourceGroups/{{user `resource_group`}}/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}", + + "source": "credativ:Debian:9:latest" + }], + "provisioners": [{ + "inline": [ + "apt-get update", + "apt-get upgrade -y" + ], + "inline_shebang": "/bin/sh -x", + "type": "shell" + }] +} diff --git a/website/source/docs/builders/azure-chroot.html.md.erb b/website/source/docs/builders/azure-chroot.html.md.erb index ab5af6cb8..71b488deb 100644 --- a/website/source/docs/builders/azure-chroot.html.md.erb +++ b/website/source/docs/builders/azure-chroot.html.md.erb @@ -101,3 +101,40 @@ mounts `/prod` and `/dev`: - The mount directory. +## Example +Here is an example that creates a Debian image with updated packages. Specify +all environment variables (`ARM_CLIENT_ID`, `ARM_CLIENT_SECRET`, +`ARM_SUBSCRIPTION_ID`) to use a service principal, specify only `ARM_SUBSCRIPTION_ID` +to use interactive login or leave them empty to use the system-assigned identity +of the VM you run Packer on. +The identity you choose should have permission to create disks and images and also +to update your VM. + +``` json +{ + "variables": { + "client_id": "{{env `ARM_CLIENT_ID`}}", + "client_secret": "{{env `ARM_CLIENT_SECRET`}}", + "subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}" + }, + "builders": [{ + "type": "azure-chroot", + + "client_id": "{{user `client_id`}}", + "client_secret": "{{user `client_secret`}}", + "subscription_id": "{{user `subscription_id`}}", + + "image_resource_id": "/subscriptions/{{user `subscription_id`}}/resourceGroups/{{user `resource_group`}}/providers/Microsoft.Compute/images/MyDebianOSImage-{{timestamp}}", + + "source": "credativ:Debian:9:latest" + }], + "provisioners": [{ + "inline": [ + "apt-get update", + "apt-get upgrade -y" + ], + "inline_shebang": "/bin/sh -x", + "type": "shell" + }] +} +``` \ No newline at end of file