Open In App

Microsoft Azure – Create Image Gallery and Image Definition

Last Updated : 30 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Pre-requisite:- Azure

In this article, we will show you how to create an image gallery and image definition in Azure which can be used to save images with versions in it. We will be using the simple Azure Powershell commands in the form to script to create this image gallery and definition in azure.

Pre-requisites:-

  • Owner or Contributor or Custom Read and Write Role to deploy resources within subscription or resource group.
  • Existing resource group. Create one if you wish to add a new resource group.

Implementation

Step 1: Log in to Azure Portal

Step 2: Access Azure Cloud Schell and select PowerShell

Step 3: Create a file named createSharedImgDef.ps1

> touch createSharedImgDef.ps1
powershell

 

Step 4: Open the file createSharedImgDef.ps1 using the below command to code

> code createSharedImgDef.ps1
powershell

 

Copy and Paste the below script in createSharedImgDef.ps1 and modify the variables of your choice

New-AzGallery `
   -GalleryName "add sigGallery Name" `
   -ResourceGroupName "add RGroup Name" `
   -Location "add RGroup Location" `
   -Description "add sigGallery Description"
   
New-AzGalleryImageDefinition `
   -GalleryName "add sigGallery Name" `
   -ResourceGroupName "add RGroup Name" `
   -Location "add RGroup Location" `
   -Name "add sigGallery DefName" `
   -OsState "add sigGalleryDef OsState" `
   -OsType "add sigGalleryDef OsType" `
   -Publisher "add publisher Name" `
   -Offer "add offerName" `
   -Sku "add skuName"
script

 

Step 5: Save the file and execute the file using the run command

./createSharedImgDef.ps1
execute script

 

Once you are done. Check Image Gallery and Image Definition resources in Azure.

Steps to check the Image Gallery and Image Definition

Step 1: Search for Azure compute galleries from the global search

Step 2:  Select the created resource and verify the Definitions

resources

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads