Coder Social home page Coder Social logo

andif888 / azure-vm-to-sig Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 125 KB

This repo is for creating a new image version in Azure image gallery from an existing virtual machine.

Shell 27.33% Jinja 10.78% HCL 61.88%
azure-gallery azure-image ansible-playbook terraform

azure-vm-to-sig's Introduction

azure-vm-to-sig

This repo is for creating a new image version in Azure image gallery from an existing virtual machine.

The configured workflow in Github Actions or the build.sh (if you run it locally) does the following tasks:

  1. Deallocates the existing VM
  2. Creates a copy of the managed disk of the existing VM
  3. Creates a new temporary VM using the copy of the managed disk
  4. Logon to the temporary VM and runs sysprep
  5. Deallocates the temporary VM
  6. Creates a temporary managed Azure Image from the temporary VM
  7. Creates a new Azure images version in Azure Shared Image Gallery
  8. Deletes the temporary managed Azure Image
  9. Deletes the temporary VM

Various variables can be defined in env.sample
Target azure image gallery for example is defined in azure_sig_name
Target azure image definition is defined in azure_sig_image_definition_name

Pre-requisites

  1. You need an exisiting VM in Azure. It can be still running or can be deallocated.
  2. The existing VM needs to have the windows feature OpenSSH Server enabled.
    More information on enabling OpenSSH Server in Windows
  3. You need an existing Azure shared image gallery
  4. The Azure image gallery contains already a VM image definition, which matches your VM's generation (V1 or V2).

Azure SIG image definition

How to use this repo

Step 1: Fork the repo

Step 2: Copy env.sample to .env using:

The .env is in the .gitignore list. This ensure that the file never leaves your local drive when you git push.

cp env.sample .env

Step 3: Adjust variables in .env

Please read the comments in .env. The should be self explanatory.

Step 4: Copy the content of .env into a Github Action secret named envfile

Create a new repository secret in Github under Settings > Secrets named envfile and copy&paste the complete content of your .env file.

github_secret

Step 5: Goto Github Actions and run the workflow

  1. Goto Actions
  2. Choose the workflow generate_new_image_version
  3. Run the Workflow generate_new_image_version

Choose Run Workflow and enter corresponding values.

Step 3: Run Workflow

Wait for the workflow to finish and check results

Wait for the workflow to finish and check results.

azure-vm-to-sig's People

Contributors

andif888 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

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.