Git Product home page Git Product logo

packer-azure's Introduction

THIS PROJECT DEPRECATED

This project is no longer actively maintained, please use the azure-arm builder in the official packer.io package.

packer-azure Build Status Code Coverage

Packer is an open source tool for creating identical machine images for multiple platforms from a single source configuration. This is an Azure plugin for Packer.io to enable Microsoft Azure users to build custom images given an Azure image.

You must have an Azure subscription to begin using Azure. You can build both Linux and Windows Azure images (targets) from both Windows and Linux dev-boxes (clients) with these plugins.

Packer version the plug-ins were tested is 0.7.5

Usage

packer-azure utilizes Service Management REST API and Storage Services REST API and consists of two plug-ins: packer-builder-azure and packer-provisioner-azure-custom-script-extension (for Windows targets). For Linux targets use well known "shell" provisioner; More information about the custom script provisioner can be found at http://msdn.microsoft.com/en-us/library/dn781373.aspx To start using the plugin you will need to get PublishSetting profile for your azure subscriptions. Visit https://manage.windowsazure.com/publishsettings to download the publish profile for the currently logged in user.

You can download binaries from the releases for this project and drop them in your packer install directory or you can build the plugins from source (see below). Configuration examples can be found in the config_examples directory.

Building from source

  • Install Go 1.5.3 or newer. Go and packer-azure dependencies require git to be installed as well.
  • Install packer
  • Set the environment variable GO15VENDOREXPERIMENT to 1 when using Go 1.5.
  • To build the plugins set the GOBIN environment variable to your packer install directory and run go get github.com/Azure/packer-azure/packer/plugin/...

Dependencies (as of 2016-03-15)

  • github.com/Azure/azure-sdk-for-go
  • github.com/Azure/go-autorest
  • github.com/Azure/go-ntlmssp
  • github.com/Azure/packer-azure
  • github.com/mitchellh/go-homedir
  • github.com/mitchellh/multistep
  • github.com/mitchellh/packer
  • github.com/pborman/uuid
  • golang.org/x/crypto

Please see the ARM README for getting started with packer-azure for ARM.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

packer-azure's People

Contributors

ahmetb avatar boumenot avatar lalyos avatar ldanielw1 avatar mbearup avatar paulmey avatar ravbaba avatar shalupov avatar snesha avatar vladimir-shcherbakov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-azure's Issues

Enable VNet specification

Allow users to specify virtual network and subnet for deployment. This can be useful for accessing protected resources, e.g. on an expressroute or a VM without public endpoints.
Implemented by #30 for Linux, but need generic implementation.

Workflow consideration - attach VHD as disk, but don't boot

As I understand the current workflow:

  • Acquire an image
  • Boot it
  • Modify it during the provisioning sequence
  • Publish it

There's an additional workflow for building Linux VMs that would be useful to enable:

  • Acquire an image
  • Mount it as a disk (using the same OS for the host as for the VHD that is mounted)
  • Modify the contents of the mounted disk, but not the host OS
  • Detach disk
  • Publish the attached disk that was modified

Thoughts on enabling this scenario?

It can likely be implemented using a round-about set of scripts in the provisioning step, but seems like it would be nice to have as a first-class facility in the workflow.

Packer hangs when trying to stop temporary Azure VM

Packer hangs when trying to stop temporary Azure VM

2014/10/08 13:37:05 packer-builder-azure: 2014/10/08 13:37:05 operation: &{{http://schemas.microsoft.com/windowsazure Operation} http://schemas.microsoft.com/windowsazure b746cfa2-ab2e-1054-b884-92d02697f63e Succeeded 200 { }}
2014/10/08 13:37:05 ui: ==> azure: Creating Temporary Azure VM...
2014/10/08 13:37:08 packer-builder-azure: 2014/10/08 13:37:08 Exec responce: &{202 Accepted 202 HTTP/1.1 1 1 map[X-Ms-Request-Id:[90b8e9be99bb10d2a3b7ee8dbe3f5450] Date:[Wed, 08 Oct 2014 17:37:07 GMT] Cache-Control:[no-cache] Content-Length:[0] Server:[1.0.6198.130 (rd_rdfe_stable.140925-2236) Microsoft-HTTPAPI/2.0] X-Ms-Servedbyregion:[ussouth2]] 0xc2084fefc0 0 [] false map[] 0xc2082f48f0 0xc2083594a0}
2014/10/08 13:37:08 packer-builder-azure: 2014/10/08 13:37:08 Exec responce: &{200 OK 200 HTTP/1.1 1 1 map[X-Ms-Request-Id:[7fbfebc8c0971a5f81765aebc1e02c83] Date:[Wed, 08 Oct 2014 17:37:07 GMT] Cache-Control:[no-cache] Content-Length:[197] Content-Type:[application/xml; charset=utf-8] Server:[1.0.6198.130 (rd_rdfe_stable.140925-2236) Microsoft-HTTPAPI/2.0] X-Ms-Servedbyregion:[ussouth2]] 0xc2084ff0c0 197 [] false map[] 0xc2082f49c0 0xc2083594a0}
2014/10/08 13:37:08 packer-builder-azure: 2014/10/08 13:37:08 operation: &{{http://schemas.microsoft.com/windowsazure Operation} http://schemas.microsoft.com/windowsazure 90b8e9be-99bb-10d2-a3b7-ee8dbe3f5450 InProgress { }}
2014/10/08 13:37:08 packer-builder-azure: 2014/10/08 13:37:08 Waiting for another 15 seconds...
2014/10/08 13:37:23 packer-builder-azure: 2014/10/08 13:37:23 Exec responce: &{200 OK 200 HTTP/1.1 1 1 map[Content-Length:[232] Content-Type:[application/xml; charset=utf-8] Server:[1.0.6198.130 (rd_rdfe_stable.140925-2236) Microsoft-HTTPAPI/2.0] X-Ms-Servedbyregion:[ussouth2] X-Ms-Request-Id:[2726d88f99021f29ae1655476183fe47] Date:[Wed, 08 Oct 2014 17:37:23 GMT] Cache-Control:[no-cache]] 0xc2084ff500 232 [] false map[] 0xc2082f4a90 0xc2083594a0}
2014/10/08 13:37:23 packer-builder-azure: 2014/10/08 13:37:23 operation: &{{http://schemas.microsoft.com/windowsazure Operation} http://schemas.microsoft.com/windowsazure 90b8e9be-99bb-10d2-a3b7-ee8dbe3f5450 Succeeded 200 { }}
2014/10/08 13:37:23 ui: ==> azure: Polling Temporary Azure VM is ready...
2014/10/08 13:37:23 packer-builder-azure: 2014/10/08 13:37:23 Sleeping for 2 min to make the VM to start
2014/10/08 13:39:25 packer-builder-azure: 2014/10/08 13:39:25 Exec responce: &{200 OK 200 HTTP/1.1 1 1 map[Content-Type:[application/xml; charset=utf-8] Server:[1.0.6198.130 (rd_rdfe_stable.140925-2236) Microsoft-HTTPAPI/2.0] X-Ms-Servedbyregion:[ussouth2] X-Ms-Request-Id:[e0e4023eaf6018e89c48b09e6babb5f8] Date:[Wed, 08 Oct 2014 17:39:25 GMT] Cache-Control:[no-cache] Content-Length:[3254]] 0xc2084ffb80 3254 [] false map[] 0xc2082f4b60 0xc2083594a0}
2014/10/08 13:39:25 packer-builder-azure: 2014/10/08 13:39:25 deployment:
2014/10/08 13:39:25 packer-builder-azure: &{{http://schemas.microsoft.com/windowsazure Deployment} http://schemas.microsoft.com/windowsazure PkrVMfz8d7qr1bl Production d285bdb6afba4febae7939b0482504cd Running UGtyVk1mejhkN3FyMWJs http://pkrsrvfz8d7qr1bl.cloudapp.net/ PFNlcnZpY2VDb25maWd1cmF0aW9uIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL1NlcnZpY2VIb3N0aW5nLzIwMDgvMTAvU2VydmljZUNvbmZpZ3VyYXRpb24iPg0KICA8Um9sZSBuYW1lPSJQa3JWTWZ6OGQ3cXIxYmwiPg0KICAgIDxJbnN0YW5jZXMgY291bnQ9IjEiIC8+DQogIDwvUm9sZT4NCjwvU2VydmljZUNvbmZpZ3VyYXRpb24+ [{PkrVMfz8d7qr1bl PkrVMfz8d7qr1bl ProvisioningFailed 0 0 Medium Provisioning image FAILED Failed to deploy key pair (0x0A). 100.78.60.42 [{SSH 191.238.242.17 65448 22 tcp}] Started PkrVMfz8d7qr1bl 9a0764828923b6820c61e04e57176c1c { { }} []}] 1 [{PkrVMfz8d7qr1bl PersistentVMRole [{NetworkConfiguration [{22 SSH 65448 tcp 191.238.242.17}]}] [] {ReadWrite PkrVMfz8d7qr1bl-PkrVMfz8d7qr1bl-0-201410081737090203 https://schladen.blob.core.windows.net/images/PkrVMfz8d7qr1bl.vhd 5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS-65-20140926 Linux} Medium}] false false 2014-10-08T17:37:07Z 2014-10-08T17:39:25Z [{ }] {2014-09-29T11:15:43Z 2014-10-01T11:15:43Z PersistentVMUpdateScheduled} [{ true PkrVMfz8d7qr1blContractContract}] {{ } []}}
2014/10/08 13:39:25 ui: azure: VM Endpoint: 191.238.242.17:65448
2014/10/08 13:39:25 ui: azure: VM DiskName: PkrVMfz8d7qr1bl-PkrVMfz8d7qr1bl-0-201410081737090203
2014/10/08 13:39:25 ui: azure: VM MediaLink: https://schladen.blob.core.windows.net/images/PkrVMfz8d7qr1bl.vhd
2014/10/08 13:39:25 packer-builder-azure: 2014/10/08 13:39:25 Waiting for SSH, up to timeout: 20m0s
2014/10/08 13:39:25 ui: ==> azure: Waiting for SSH to become available...
2014/10/08 13:39:29 packer-builder-azure: 2014/10/08 13:39:29 Attempting SSH connection...
2014/10/08 13:39:29 packer-builder-azure: 2014/10/08 13:39:29 reconnecting to TCP connection for SSH
2014/10/08 13:39:29 packer-builder-azure: 2014/10/08 13:39:29 handshaking with SSH
2014/10/08 13:39:30 ui: ==> azure: Connected to SSH!
2014/10/08 13:39:30 packer-builder-azure: 2014/10/08 13:39:30 Running the provision hook
2014/10/08 13:39:30 ui: ==> azure: Uploading XXXXXX
2014/10/08 13:39:30 packer-builder-azure: 2014/10/08 13:39:30 opening new ssh session
2014/10/08 13:39:30 packer-builder-azure: 2014/10/08 13:39:30 Starting remote scp process: scp -vt /tmp
2014/10/08 13:39:30 packer-builder-azure: 2014/10/08 13:39:30 Started SCP session, beginning transfers...
2014/10/08 13:39:30 packer-builder-azure: 2014/10/08 13:39:30 Copying input data into temporary file so we can read the length
2014/10/08 13:39:31 packer-provisioner-file: 2014/10/08 13:39:31 [INFO] 38343344 bytes written for 'uploadData'
2014/10/08 13:39:31 [INFO] 38343344 bytes written for 'uploadData'
2014/10/08 13:39:31 packer-command-build: 2014/10/08 13:39:31 [INFO] 38343344 bytes written for 'uploadData'
2014/10/08 13:39:31 [INFO] 38343344 bytes written for 'uploadData'
2014/10/08 13:39:32 packer-builder-azure: 2014/10/08 13:39:32 [DEBUG] Uploading kms-server-1.7.0-SNAPSHOT.jar: perms=C0644 size=38343344
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 SCP session complete, closing stdin pipe.
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Waiting for SSH session to complete.
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 scp stderr (length 51): Sink: C0644 38343344 kms-server-1.7.0-SNAPSHOT.jar
2014/10/08 13:41:34 ui: ==> azure: Uploading XXXXXXXX
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 opening new ssh session
2014/10/08 13:41:34 packer-provisioner-file: 2014/10/08 13:41:34 [INFO] 250 bytes written for 'uploadData'
2014/10/08 13:41:34 [INFO] 250 bytes written for 'uploadData'
2014/10/08 13:41:34 packer-command-build: 2014/10/08 13:41:34 [INFO] 250 bytes written for 'uploadData'
2014/10/08 13:41:34 [INFO] 250 bytes written for 'uploadData'
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Starting remote scp process: scp -vt /tmp
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Started SCP session, beginning transfers...
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Copying input data into temporary file so we can read the length
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 [DEBUG] Uploading jetty.properties: perms=C0644 size=250
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 SCP session complete, closing stdin pipe.
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Waiting for SSH session to complete.
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 scp stderr (length 33): Sink: C0644 250 jetty.properties
2014/10/08 13:41:34 ui: ==> azure: Uploading XXXXXXXX
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 opening new ssh session
2014/10/08 13:41:34 [INFO] 2254 bytes written for 'uploadData'
2014/10/08 13:41:34 packer-provisioner-file: 2014/10/08 13:41:34 [INFO] 2254 bytes written for 'uploadData'
2014/10/08 13:41:34 packer-command-build: 2014/10/08 13:41:34 [INFO] 2254 bytes written for 'uploadData'
2014/10/08 13:41:34 [INFO] 2254 bytes written for 'uploadData'
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Starting remote scp process: scp -vt /tmp
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Started SCP session, beginning transfers...
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 Copying input data into temporary file so we can read the length
2014/10/08 13:41:34 packer-builder-azure: 2014/10/08 13:41:34 [DEBUG] Uploading jetty_keystore.jks: perms=C0644 size=2254
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 SCP session complete, closing stdin pipe.
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 Waiting for SSH session to complete.
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 scp stderr (length 36): Sink: C0644 2254 jetty_keystore.jks
2014/10/08 13:41:35 ui: ==> azure: XXXXXXXX
2014/10/08 13:41:35 packer-provisioner-file: 2014/10/08 13:41:35 [INFO] 1552 bytes written for 'uploadData'
2014/10/08 13:41:35 [INFO] 1552 bytes written for 'uploadData'
2014/10/08 13:41:35 packer-command-build: 2014/10/08 13:41:35 [INFO] 1552 bytes written for 'uploadData'
2014/10/08 13:41:35 [INFO] 1552 bytes written for 'uploadData'
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 opening new ssh session
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 Starting remote scp process: scp -vt /tmp
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 Started SCP session, beginning transfers...
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 Copying input data into temporary file so we can read the length
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 [DEBUG] Uploading kms.service: perms=C0644 size=1552
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 SCP session complete, closing stdin pipe.
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 Waiting for SSH session to complete.
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 scp stderr (length 29): Sink: C0644 1552 kms.service
2014/10/08 13:41:35 ui: ==> azure: Executing OS generalization...
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 opening new ssh session
2014/10/08 13:41:35 packer-builder-azure: 2014/10/08 13:41:35 starting remote command: sudo /usr/sbin/waagent -force -deprovision && export HISTSIZE=0
2014/10/08 13:41:36 packer-builder-azure: 2014/10/08 13:41:36 remote command exited with '0': sudo /usr/sbin/waagent -force -deprovision && export HISTSIZE=0
2014/10/08 13:41:36 packer-builder-azure: 2014/10/08 13:41:36 OS generalization stdout: WARNING! The waagent service will be stopped.
2014/10/08 13:41:36 packer-builder-azure: WARNING! All SSH host key pairs will be deleted.
2014/10/08 13:41:36 packer-builder-azure: WARNING! Cached DHCP leases will be deleted.
2014/10/08 13:41:36 packer-builder-azure: WARNING! Nameserver configuration in /etc/resolv.conf will be deleted.
2014/10/08 13:41:36 packer-builder-azure: WARNING! root password will be disabled. You will not be able to login as root.
2014/10/08 13:41:36 packer-builder-azure: 2014/10/08 13:41:36 OS generalization stderr:
2014/10/08 13:41:36 ui: ==> azure: Stopping Temporary Azure VM...
^C
[mary@localhost deployment]$ date
Wed Oct 8 14:01:31 EDT 2014

Sample Input:

{
"variables": {
"sn": "XXX",
"psPath": "XXX",
"storage": "XX",
"location": "South Central US",
"size": "Medium",
"label": "XXX",
"home": "XXX"
},
"builders": [
{
"type": "azure",
"publish_settings_path": "{{user psPath}}",
"subscription_name": "{{user sn}}",
"storage_account": "{{user storage}}",
"storage_account_container": "images",
"os_type": "Linux",
"os_image_label": "OpenLogic 6.5",
"location": "{{user location}}",
"instance_size": "{{user size}}",
"user_image_label": "{{user label}}"
}
],
"provisioners": [
{
"type": "file",
"source": "{{user home}}/XXX.jar",
"destination": "/tmp/XXX.jar"
},
{
"type": "file",
"source": "{{user home}}/jetty.properties",
"destination": "/tmp/jetty.properties"
},
{
"type": "file",
"source": "{{user home}}/jetty_keystore.jks",
"destination": "/tmp/jetty_keystore.jks"
},
{
"type": "file",
"source": "{{user home}}/tools/deployment/pack/kms.service",
"destination": "/tmp/kms.service"
}
]
}

cant build images from User category

Build images from User category fails:

Build 'azure' errored: Some Azure options failed: Can't find OS image 'packertest-20140922-658861' located at 'West Europe'

Image info:

info:    Executing command vm image show
+ Fetching VM image                                                            
data:    name "packertest-20140922-658861"
data:    label "packertest-gen-1"
data:    category "User"
data:    oSDiskConfiguration name "packertest-20140922-658861-os-2014-09-22"
data:    oSDiskConfiguration hostCaching "ReadWrite"
data:    oSDiskConfiguration oSState "Generalized"
data:    oSDiskConfiguration operatingSystem "Linux"
data:    oSDiskConfiguration mediaLink "https://imazure.blob.core.windows.net/vhds/packertest-20140922-658861-os-2014-09-22.vhd"
data:    oSDiskConfiguration logicalDiskSizeInGB 30
data:    serviceName "packertest"
data:    deploymentName "packertest"
data:    roleName "packertest"
data:    location "West Europe"
data:    createdTime 2014-09-22T09:12:18.021Z
data:    modifiedTime 2014-09-22T09:12:18.021Z
data:    isPremium false
info:    vm image show command OK

Public Port specification on Endpoints

Would it be possible to add a parameter to the builder that specifies the Public Port for the Remote Desktop endpoint for the temporary VM instance.

Since the allocated Public Port is random, the Azure Plugin is failing because WinRM can't get through our company firewall. Our Sys Admin has given my machine temporary access through the firewall but this is not ideal.

Racy pemfile creation causes errors for parallel builds

I'm consistently getting errors when trying to build two images in parallel with the same subscription. It looks like the first build enters this if block and writes the tag file, then the next build sees the tagfile and immediately tries to read the pemfile, even though it hasn't finished being written yet.

This results in an error like this:

Build 'XXXX' errored: Error creating request manager: Failed to Parse PublishSettings: open /home/ubuntu/.packer_azure/XXXX/cert.pem: no such file or directory

Packer build gets failed for Specialized Image (i.e Create Custom image without running Sysprep)

Repo:

  1. Create Custom image without running Sysprep
  2. Set the json with the created custom image
  3. Run the packer build command
    Actual: Build gets failed and throws following error
    Build 'azure' errored: Error Creating Temporary Azure VM: New-AzureVM : BadRequest: No Configuration Set should be specified while using
    a VMImage with a specialized OS Disk Configuration.
    At line:1 char:797

Missing hyper-v module

Hi, I'm getting the following error trying to run packer-azure:

D:\Users\erikkri\Downloads\packer>packer -debug build packer-azure_Ubuntu.json
azure output will be in this color.

Build 'azure' errored: Failed creating Hyper-V driver: PS Hyper-V module is not
loaded. Make sure Hyper-V feature is on.

==> Some builds didn't complete successfully and had errors:
--> azure: Failed creating Hyper-V driver: PS Hyper-V module is not loaded. Make
sure Hyper-V feature is on.

==> Builds finished but no artifacts were created.

D:\Users\erikkri\Downloads\packer>�

The powershell hyper-v module from here is installed:

http://pshyperv.codeplex.com/

I have also installed the Azure Powershell module.

Provisioner type - powershell-azure not working

Is Provisioner type - powershell-azure even supported? I can see it in examples, one of the example is https://github.com/MSOpenTech/packer-azure/blob/master/config_examples/packer-azure_Win2012r2_inet.json but when i execute it, it simply doesn't work.

As per code, powershell-azure is not even supported. When i check the following file, it doesn't even import powershell/communicator.go which indicates that only provisioner type azure-custom-script-extension is supported.

https://github.com/MSOpenTech/packer-azure/blob/master/packer/builder/azure/driver_restapi/targets/win/step_set_provision_infrastructure.go

Am i missing something? I am using the current release version.

Confirmation that generated image is compliant with "How to Capture a Linux Virtual Machine to Use as a Template"?

Hello,

I am sorry to use the issue tracker for a question but I did not find a forum.

Can you confirm that packer-azure follow the recommendations of Azure > How to Capture a Linux Virtual Machine to Use as a Template and thus are aligned with the expectations of the Certification Test Tool for Azure Certified ?

I saw in driver_restapi/builder.go that waagent -deprovision is properly called so I guess it is ok.

Cyrille

VM creation is not successful for OpenSUSE and CentOS

Description:
VM creation is not successful from the VHD file created by packer for OpenSUSE and CentOS. "Installing extension in Virtual machine" is being displayed in Azure

Note:1. We did not observed any error message while creating VHD file
2. Same message("Installing extension in Virtual machine") is being displayed for ubuntu also but we are able to successfully ssh into the Ubuntu VM

image

image

Latest version of plugin doesn't work with Packer 0.7.1

It seems that the rename of the plug-in confuses packer. When I copy the windows binaries into the packer directory and then run packer on a configuration to create a VM on Azure packer complains that it can't find builder-azure. After renaming the plugin packer can find it and starts it.

Password Authentication is not working for Linux(Packer made images)

Steps

  1. Create Packer image of OS type (Linux)
  2. Create VM on Azure by selecting the image which is created by Packer.
  3. Connect the VM using Putty
  4. VM Connection establishment gets failed.
  5. Able to connect VM using key

Currently Packer made images are not supporting Password Authentication

azure subscription not being set

Hardcoding the subscription information into the builders section picks up my session information but putting the same value in variables, causes the Add-Subscription pop up each time.

Building multiple copies of same image leads to problems - PowerShell

In my config I specify 3 azure images to build. Packer likes the config ok and gets down to work. But (I think) because PowerShell isn't the best at parallelizing operations, one of the builds fails. Here's the message:

--> azure-seasia: Some Azure options failed: Get-AzureSubscription : The process cannot access the file 'C:\Users\hal9000\AppData\Roaming\Windows Azure Powershell\TokenCache.dat' because it is being used by another process.

Reason for multiple images - it's really the same image but in 3 different datacenters. We need images in other datacenters because customers would experience unsatisfactory latency if a VM had to be built from an image in a remote DC.
I noticed in the bin directory a version that's based on the Service Management API - any chance that will be extended to work on Windows? Another solution?

azure vm show <vmname> - does not show user created vm's, only public?

Hi,
I noticed I can see user created vm's through the web portal, but not via the command line. Any ideas on how to get them to show up?

eg, I can see the image, but

azure vm show PackerMade_Ubuntu_Serv14_2015-May-1_16-29
info: Executing command vm show

  • Getting virtual machines
    warn: No VMs found
    info: vm show command OK

    vm image list
    data: PackerMade_Ubuntu_Serv14_2015-May-1_16-29 User Linux

packer build adds datestamp to name: how to turn off

Hi,

When using the azure packer, the finished image has _2015-March-17_7-37-os-2015-03-17 to it's name.

How can this be turned off/removed?

I use 'name' in the builder section:

{
"builders":[{
"type": "azure",
"publish_settings_path": "my-pass",
"subscription_name": "My Pass",
"storage_account": "storage",
"storage_account_container": "images",
"os_type": "Linux",
"os_image_label": "Ubuntu Server 14.04 LTS",
"location": "North Europe",
"instance_size": "Small",
"user_image_label": "test",
"name": "test"
}],

the created image is called test _2015-March-17_7-37-os-2015-03-17, but I would like it to be just 'test'

D

Clarification: Does packer azure support Post-processor section in json?

Description: Build fails with the error message "Post-processor failed: Unknown artifact type, can't build box:MSOpenTech.azure" if we provide post-processor in json template file("post-processors": [{"type": "vagrant","compression_level": 1}])
Build version: 0.6.1
Expected result: Build should be successful and vhd file should be created. Also should be able to create VM out of the vhd file created.
Clarification: Does packer azure plugin can be used to create box file which can be used for Vagrant?
Note: Packer hyper-v plugin used to create box file with this settings

Unable to find subscription with multiple subscriptions

When trying to connect to my Azure subscription I get an error say that packer-azure couldn't find my subscription. Originally I thought that was due to the fact that I had the wrong name but after trying out the powershell command line that is in the packer-azure source it turns out there are two subscriptions with the same name (both are called "Visual Studio Premium with MSDN") but they have different ID's.

Is there a way for packer-azure to select one, e.g. can I provide an ID or something else for it to use?

Packer build gets failed for Generalized type of images

Repo:

  1. Create Custom image by running Sysprep
  2. Set the json with the created custom image
  3. Run the packer build command
    Actual: Build gets failed and throws following error
    azure: Error Removing Temporary Azure Disk: Remove-AzureDisk : Cannot valida
    te argument on parameter 'DiskName'. The
    ==> azure: argument is null or empty. Provide an argument that is not null or em
    pty, and
    ==> azure: then try the command again.
    ==> azure: At line:1 char:301
    ==> azure: + ... Disk -DiskName $disk.DiskName;}
    ==> azure: + ~~~~~~~~~~~~~~
    ==> azure: + CategoryInfo : InvalidData: (:) [Remove-AzureDisk], Pa
    rameterBi
    Note: This issue is not reproducible with old build.

Builder failing waiting for RPC

Hi all, can anyone suggest what I need to do to get past this problem...

Waiting for RPC address for: C:\Program Files (x86)\Packer\packer-builder-azure.exe
ui error: Failed to create build 'azure':
timeout while waiting for plugin to start

I'm using Packer v0.7.5 and this is my builder...

"builders": [{
"type": "azure",
"subscription_name": "My Trial",
"storage_account" : "portalvhdsxxxxxxxxxxx",
"os_type" : "Windows",
"os_image_label" : "3a50f22b388a4ff7ab41029918570fa6__Windows-Server-2012-Essentials-20131217-enus",
"location" : "Australia Southeast",
"instance_size" : "Medium",
"user_image_label" : "FirstAttempt-0112-0438"
}],

VHD creation failed for specified gallery images

Description: VHD creation was not successful if -

  1. "os_image_label" : "SUSE Linux Enterprise Server11 SP3",
  2. "os_image_label" : "Ubuntu Server 12.04 LTS"
    in the json file

Find the json file below-
{
"variables":
{
},

"builders": 
[
    {
        "type"              : "azure",
        "subscription_name" : "",
        "storage_account"   : "gruntstg",
        "os_type"           : "Linux",
        "os_image_label"    : "Ubuntu Server 12.04 LTS",
        "location"          : "West US",
        "instance_size"     : "Small",
        "user_image_label"  : "PackerMade_UbuntuImage"
    }
]

,"provisioners": [
    {
        "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
        "inline": [
            "sudo apt-get update",
            "sudo apt-get install -y mc",
            "sudo apt-get install -y default-jre"
        ],
        "inline_shebang": "/bin/sh -x",
        "type": "shell"
    }
]

}

Note: we ensured that the image is available in gallery image list

image

image

Typo: "paker made image"

This string appears in a few go source files and appears in the metadata associated with the built images.

errors installing driver_restapi

go get github.com/MSOpenTech/packer-azure/packer/builder/azure/driver_restapi

github.com/MSOpenTech/packer-azure/packer/builder/azure/driver_restapi

../../MSOpenTech/packer-azure/packer/builder/azure/driver_restapi/builder.go:44: undefined: packer.ConfigTemplate

I have tried with binary packer 0.7.2 and 0.7.5, compiled dev version (0.7.5) and still get the same error.
Also tried golang 1.3 and 1.4

Using CentOS 7, will all updates as of 8/6

really need to get this working since we working to get our product into Azure via packer.

Error Removing Temporary Azure Disk

Received this error when trying to build image with Ubuntu 14.04 LTS Medium in North Europe.

Error Removing Temporary Azure Disk: Error response from Azure. Code: ConflictError, Message: Windows Azure is currently performing an operation on deployment that requires exclusive access. Please try again later for operation on disk or image associated with the deployment

Clarification: Does packer plugin support Linux ubuntu 12.04 environment?

We tested packer v0.6.0 and 0.6.1 in Linux by creating a Ubuntu VM in Azure-

Detail steps have been mentioned in the link below-
https://www.digitalocean.com/community/tutorials/how-to-install-and-get-started-with-packer-on-an-ubuntu-12-04-vps

After executing packer command, we encountered below error message in putty-
packer
No command 'packer' found, did you mean:
Command 'pauker' from package 'pauker' (universe)
packer: command not found

Intermittent Build Failure

Hi Vlad,

Sometimes when I run packer, I hit a failure due to "Windows Azure is currently performing an operation on this deployment that requires exclusive access". I'm sorry I don't have more logging information. I retried running packer and the image was successfully created. Is there retry logic around "Deleting Temporary Directory"?

thanks

mary

==> azure: Executing OS generalization...
==> azure: Stopping Temporary Azure VM...
==> azure: Creating Azure Image. If Succeed This Will Remove the Temorary VM...
==> azure: Error Creating Azure Image: Manager.ExecuteSync: Windows Azure is currently performing an operation on this deployment that requires exclusive access.
==> azure: Removing Temporary Azure Service and It's Deployments If Any...
==> azure: Deleting Temporary Certificate...
azure: Deleting Temporary Directory...
Build 'azure' errored: Error Creating Azure Image: Manager.ExecuteSync: Windows Azure is currently performing an operation on this deployment that requires exclusive access.

==> Some builds didn't complete successfully and had errors:
--> azure: Error Creating Azure Image: Manager.ExecuteSync: Windows Azure is currently performing an operation on this deployment that requires exclusive access.

==> Builds finished but no artifacts were created.
Packer has finished

ERROR: Packer build was unsuccessful

Packer dies while waiting for SSH to become available

Hi,

I'm having issues getting packer-azure to work from a mac, as it boots up a machine, but cannot connect to it. I'm getting this output:
Debug mode enabled. Builds will not be parallelized.
azure output will be in this color.

==> azure: Preparing builder...
azure: Creating a new request manager...
==> azure: Validating Azure Options...
azure: Checking Storage Account...
azure: Checking OS image with the label 'OpenLogic 6.5' exists...
azure: Found 2 image(s).
azure: Take the most recent:
azure: OS Image Label: OpenLogic 6.5
azure: OS Image Family:
azure: OS Image Name: 5112500ae3b842c8b9c604889f8753c3__OpenLogic-CentOS-65-20150325
azure: OS Image PublishedDate: 2015-03-25T00:00:00Z
==> azure: Creating Temporary Certificate...
azure: Creating Temporary Directory...
azure: CertPath: /var/folders/yf/cwnpl2wx6638n239y_7jgjx000089n/T/packer_cert874104718/cert.pem
azure: thumbprint: 2B50B7420215714ACA6699CA046979CAD5A713AA
==> azure: Pausing after run of step 'StepCreateCert'. Press enter to continue.
==> azure: Creating Temporary Azure Service...
==> azure: Pausing after run of step 'StepCreateService'. Press enter to continue.
==> azure: Uploading Temporary Certificate...
==> azure: Pausing after run of step 'StepUploadCertificate'. Press enter to continue.
==> azure: Creating Temporary Azure VM...
load: 1.29 cmd: packer-provision 75986 running 0.00u 0.00s
==> azure: Pausing after run of step 'StepCreateVm'. Press enter to continue.
==> azure: Polling Temporary Azure VM is ready...
azure: VM Endpoint: 104.45.214.160:%!d(string=22)
azure: VM DiskName: PkrVMxf08xjdn0o-PkrVMxf08xjdn0o-0-201504022044240891
azure: VM MediaLink: https://packertest.blob.core.windows.net/test/PkrVMxf08xjdn0o.vhd
==> azure: Pausing after run of step 'StepPollStatus'. Press enter to continue.
==> azure: Waiting for SSH to become available...
==> azure: Timeout waiting for SSH.
==> azure: Pausing before cleanup of step 'StepPollStatus'. Press enter to continue.
==> azure: Pausing before cleanup of step 'StepCreateVm'. Press enter to continue.
==> azure: Pausing before cleanup of step 'StepUploadCertificate'. Press enter to continue.
==> azure: Pausing before cleanup of step 'StepCreateService'. Press enter to continue.
==> azure: Removing Temporary Azure Service and It's Deployments If Any...
==> azure: Pausing before cleanup of step 'StepCreateCert'. Press enter to continue.
==> azure: Deleting Temporary Certificate...
azure: Deleting Temporary Directory...
Build 'azure' errored: Timeout waiting for SSH.

==> Some builds didn't complete successfully and had errors:
--> azure: Timeout waiting for SSH.

==> Builds finished but no artifacts were created.

and my JSON is:
{
"builders":
[{
"type": "azure",
"publish_settings_path": "test.publishsettings",
"subscription_name": "XXXXX",
"storage_account": "XXXXX",
"storage_account_container": "test",
"os_type": "Linux",
"os_image_label": "OpenLogic 6.5",
"location": "West US",
"instance_size": "Small",
"user_image_label": "testcentos"
}],
"provisioners":
[{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
"inline": [ "sudo apt-get update",
"sudo apt-get install -y mc",
"sudo apt-get install -y nodejs",
"sudo apt-get install -y npm",
"sudo npm install azure-cli -g"
],
"inline_shebang": "/bin/sh -x"
}]
}

Do you guys know why this might be happening? Am I doing something wrong with my json file? All I'm doing is calling:
packer build test.json

Failed to create Powershell driver due to loaded module invoking Write-Host

When starting packer with the azure plugin I get the following output:

←[1;32mazure output will be in this color.←[0m
←[1;31mBuild 'azure' errored: Failed creating PowerShell driver: strconv.ParseInt: parsing "[Jump-location] Database contains 21 records.\n\n4": invalid syntax←[0m

==> Some builds didn't complete successfully and had errors:
--> azure: Failed creating PowerShell driver: strconv.ParseInt: parsing "[Jump-location] Database contains 21 records.\n\n4": invalid syntax

==> Builds finished but no artifacts were created.

This seems to be due to the fact that one of the modules in my powershell configuration outputs some data to the host. If no data is output to the host packer starts just fine.

Long running extensionSettings time out, even if they are still running on the host

I'm using packer to provision a machine that installs a large program during the provisioning state (Visual Studio Community). It looks like the timeout is 20 minutes due to a hard-coded limit on the polling loop.

It would be cool if (https://github.com/MSOpenTech/packer-azure/blob/master/packer/communicator/azureVmCustomScriptExtension/communicator.go#L200) could be set as an optional parameter in the json file. Perhaps also changing the sleep time from 40seconds -> 60seconds would be helpful, because then the parameter could be called something like "Timeout Minutes."

I'm willing to write a pull request if you think this is a good idea. I may fork and write it for my own personal use anyways.

Azure Packer Build Request timed out

azure output will be in this color.

==> azure: Preparing builder...
azure: Getting subscr info...
azure: Creating a New Driver...
azure: Creating a New Request Manager...
==> azure: Validating Azure Options...
azure: Checking Storage Account...
Build 'azure' errored: Some Azure options failed: Get https://management.core.windows.net/<subs_id>/services/storageservices/operations/isavailable/us1preprodall: dial tcp 157.55.195.251:443: connection timed out

==> Some builds didn't complete successfully and had errors:
--> azure: Some Azure options failed: Get https://management.core.windows.net/04dc0d13-8d80-4781-b4b9-603708ce871c/services/storageservices/operations/isavailable/us1preprodall: dial tcp 157.55.195.251:443: connection timed out

==> Builds finished but no artifacts were created.

Im behind an enterprise proxy. I have set up env variables http_proxy and https_proxy.

Is azure packer using the proxy settings? If not, how can I make it use the proxy settings?

Regards

Allow remote image deployment

Allow users to reference a VHD by HTTP-accessible urls. This allows builds in multiple stages and deploying VHD's from other subscriptions. This is the same mechanism that the Azure VM Marketplace uses.

VHD creation is not successfull for CentOS with packer v0.6.1

Description: when we issue the command 'packer build packer-azure_CentOS.json', build fails with error message - Build 'azure' errored: Some Azure options failed: Can't find OS image 'OpenLogic
' located at 'West US'
Log file- C:\Packer\examples>packer build packer-azure_CentOS.json
azure output will be in this color.

==> azure: Validating Azure options...
Build 'azure' errored: Some Azure options failed: Can't find OS image 'OpenLogic
' located at 'West US'
==> Some builds didn't complete successfully and had errors:
--> azure: Some Azure options failed: Can't find OS image 'OpenLogic' located at
'West US'
==> Builds finished but no artifacts were created.

Find the json file below-
{
"variables":
{
},

"builders": 
[
    {
        "type"              : "azure",
        "subscription_name" : "",
        "storage_account"   : "vagazure",
        "os_type"           : "Linux",
        "os_image_label"    : "OpenLogic",
        "location"          : "East Asia",
        "instance_size"     : "Small",
        "user_image_label"  : "PackerMade_OpenLogicImage"
    }
]

,"provisioners": [
    {
        "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
        "inline": [
            "sudo yum update -y",
            "sudo yum install -y mc"
        ],
        "inline_shebang": "/bin/sh -x",
        "type": "shell"
    }
]

}

openlogic_subscription

Concurrent calls fail to create Azure service

Concurrent calls to rand.Intn are generating the same value which is in turn causing the builder to try and create the temp Azure service with the same DNS name.

Changing the feed and using a mutex would help.

Cannot install restapi driver

When I try to install the RestAPI driver, I get the error:

bash-3.2$ go get github.com/MSOpenTech/packer-azure/packer/builder/azure/driver_restapi

# github.com/MSOpenTech/packer-azure/packer/builder/azure/driver_restapi/targets/win
../../go/src/github.com/MSOpenTech/packer-azure/packer/builder/azure/driver_restapi/targets/win/step_set_provision_infrastructure.go:99: cannot convert comm (type *azureVmCustomScriptExtension.comm) to type packer.Communicator:
    *azureVmCustomScriptExtension.comm does not implement packer.Communicator (wrong type for Upload method)
        have Upload(string, io.Reader, *os.FileInfo) error
        want Upload(string, io.Reader) error

Am I doing something wrong? Seems like it's not working. I am using Packer 0.7.2

Why does Builder-Azure need to have Admin access?

When trying to run Packer with the Builder-Azure plugin my build fails because the shell needs to be running in elevated mode. I am wondering why this is necessary? As far as I'm aware it should be possible to access all the powershell azure functions from a non-elevated shell. Having to run packer in an elevated mode will make it very difficult to automate the creation of VM's (which is what packer is supposed to do).

Error Stopping Temporary Azure VM: Remote server returned error

Hi,

Trying to build an azure image with the following conf:

{
"builders":[{
"type": "azure",
"publish_settings_path": "azure/Free Trial-1-27-2015-credentials.publishsettings",
"subscription_name": "Free Trial",
"storage_account": "xxx",
"storage_account_container": "yyy",
"os_type": "Linux",
"os_image_label": "Ubuntu Server 14.04 LTS",
"location": "West Europe",
"instance_size": "Small",
"user_image_label": "usp-174-apache24-ubuntu1404-amd64"
}],
"provisioners":[{}]

Everything goes well until the end:

azure: Error Stopping Temporary Azure VM: Remote server returned error: 'The server encountered an internal error. Please retry the request.' (10 times).

No further log.

What am I doing wrong?

Kind regards,

Dirk

Change the default username "packer"

Hi

i would like to know is it is possible change the default username that packer use to create images in azure.
everytime i create a image in azure the default user is packer and i want to change it to ubuntu.

best regards
Fernando Neto

OpenLogic images do not support SSH access

I started trying to build centOS images from packer-azure, and it's going great. Everything gets saved properly. However, when I try to create a new viritual machine from the the created image, even if I only give it a password for SSH authentication, I get denied from logging in on the basis of:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Is this a packer-azure issue? Or should I just close this issue, and talk to Microsoft Azure about this?

Where do you get publishprofile?

Hello, I have been searching everywhere, and can not find where to get the publish profile. I'm anxious to try this project out!

Thanks for the help

Provide support for MacOS X

I was able to get this to build using the instructions for linux. On running a build I got an error that the cert.pem file doesn't exist.

I traced it to this section:

https://github.com/MSOpenTech/packer-azure/blob/master/packer/builder/azure/driver_restapi/request/subcriptionManagement.go#L199

I think if you simply added an OR to the statement looking for OSX, everything else should work. I was able to generate the pem file manually using the command you run and then the builds were successful after that.

I will try to send you a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.