You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/linux/build-image-with-packer.md
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ You use the output from these two commands in the next step.
62
62
## Define Packer template
63
63
To build images, you create a template as a JSON file. In the template, you define builders and provisioners that carry out the actual build process. Packer has a [provisioner for Azure](https://www.packer.io/docs/builders/azure.html) that allows you to define Azure resources, such as the service principal credentials created in the preceding step.
64
64
65
-
Create a file named *ubuntu.json* and paste the following content. Enter your own values for the following:
65
+
Create a file named *ubuntu.json* and paste the following content. Enter your own values for the following parameters:
This template builds an Ubuntu 16.04 LTS image, installs NGINX, then deprovisions the VM.
119
153
@@ -131,6 +165,12 @@ Build the image by specifying your Packer template file as follows:
131
165
./packer build ubuntu.json
132
166
```
133
167
168
+
You can also build the image by specifying the *ubuntu.pkr.hcl* file as follows:
169
+
170
+
```bash
171
+
packer build ubuntu.pkr.hcl
172
+
```
173
+
134
174
An example of the output from the preceding commands is as follows:
135
175
136
176
```output
@@ -196,7 +236,7 @@ It takes a few minutes for Packer to build the VM, run the provisioners, and cle
196
236
197
237
198
238
## Create VM from Azure Image
199
-
You can now create a VM from your Image with [az vm create](/cli/azure/vm). Specify the Image you created with the `--image` parameter. The following example creates a VM named *myVM* from *myPackerImage* and generates SSH keys if they do not already exist:
239
+
You can now create a VM from your Image with [az vm create](/cli/azure/vm). Specify the Image you created with the `--image` parameter. The following example creates a VM named *myVM* from *myPackerImage* and generates SSH keys if they don't already exist:
Copy file name to clipboardExpand all lines: articles/virtual-machines/windows/build-image-with-packer.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ Packer authenticates with Azure using a service principal. An Azure service prin
41
41
Create a service principal with [New-AzADServicePrincipal](/powershell/module/az.resources/new-azadserviceprincipal). The value for `-DisplayName` needs to be unique; replace with your own value as needed.
This template builds a Windows Server 2016 VM, installs IIS, then generalizes the VM with Sysprep. The IIS install shows how you can use the PowerShell provisioner to run additional commands. The final Packer image then includes the required software install and configuration.
124
160
@@ -133,6 +169,11 @@ Build the image by opening a cmd prompt and specifying your Packer template file
133
169
```
134
170
./packer build windows.json
135
171
```
172
+
You can also build the image by specifying the *windows.pkr.hcl* file as follows:
173
+
174
+
```
175
+
packer build windows.pkr.hcl
176
+
```
136
177
137
178
An example of the output from the preceding commands is as follows:
0 commit comments