Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of azure builder with a custom image / image url #3785

Closed
imduffy15 opened this issue Aug 8, 2016 · 6 comments
Closed

Example of azure builder with a custom image / image url #3785

imduffy15 opened this issue Aug 8, 2016 · 6 comments

Comments

@imduffy15
Copy link
Contributor

@paulmey can you provide an example of how to use the azure builder with a custom image as the input rather than something from the market place?

I see from reading the code briefly its possible to use an image url configuration item but I haven't seen this documented anywhere.

@imduffy15
Copy link
Contributor Author

@boumenot This looks like your work - 5950d3d

@boumenot
Copy link
Collaborator

boumenot commented Aug 8, 2016

I just submitted a PR with an example for Linux and Windows.

Basically, remove this

    "image_publisher": "Canonical",
    "image_offer": "UbuntuServer",
    "image_sku": "16.04.0-LTS",

in favor of this

      "image_url": "https://my-storage-account.blob.core.windows.net/path/to/your/custom/image.vhd",

The only difference between the two is the os_type variable is set to Linux or Windows.

@imduffy15
Copy link
Contributor Author

Great thanks @boumenot

@fmosti this should help you out 😎

@sanchetanparmar
Copy link

Here is my image code for ubuntu image ### ubuntu.json

{
  "builders": [{
    "type": "azure-arm",

    "subscription_id": "XXXXXX",XXXXXXXX
     "client_id":  "XXXXXXX",
     "client_secret": "06XXXXXXX",
     "tenant_id":  "41X",XXXXXX

    "managed_image_resource_group_name": "myResourceGroup",
    "managed_image_name": "myubuntuPackerImage1234",

    "os_type": "Linux",
    "image_publisher": "Canonical",
    "image_offer": "UbuntuServer",
    "image_sku": "16.04-LTS",


    "location": "East US",
    "vm_size": "Standard_DS2_v2"
  }],
  "provisioners": [{
    "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
    "inline": [
      "apt-get update",
      "apt-get upgrade -y",
      "apt-get -y install nginx",

      "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
    ],
    "inline_shebang": "/bin/sh -x",
    "type": "shell"
  }]
}

packer build ubuntu.json

it will build successfully and output will be

OSType: Linux
ManagedImageResourceGroupName: myResourceGroup
ManagedImageName: packerimagewin2019up
ManagedImageId: /subscriptions/XXXXXXXXXX/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/myubuntuPackerImage1234
ManagedImageLocation: eastus

if i run az image list it will not show you .vdf blob url how can i use above output to create new update on existing image ### myubuntuPackerImage1234 ?

l

@sanchetanparmar
Copy link

sanchetanparmar commented Dec 15, 2019

found one solution

"shared_image_gallery": {
       "subscription": "XXXXXXXXXXXX",
        "resource_group": "myResourceGroup",
        "gallery_name": "packerubuntu",
        "image_name": "packerubuntu",
        "image_version": "0.0.1"
},

  "shared_image_gallery_destination": {
     "resource_group": "myResourceGroup",
     "gallery_name": "packerubuntu",
     "image_name": "packerubuntu",
     "image_version": "0.0.2",
     "replication_regions": ["eastus", "eastus2"]
},

with above code i can use SIG and in next build use SIG version

@ghost
Copy link

ghost commented Jan 23, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jan 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants