Azure Image Builder - Image version name

SenhorDolas 1,151 Reputation points
2021-07-02T10:08:10.19+00:00

Very new to this so bear with me.

I have been following up Azure Academy videos on how to setup an AIB pipeline and install apps on my template VM.

This works fine (I have more questions about Azure Repo but I will post separately) but the image version comes out with a funny name, is it possible to name the image version (see pic for example)

111268-capture.png

Cheers, M

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,102 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,923 questions
{count} votes

5 answers

Sort by: Most helpful
  1. kobulloc-MSFT 23,336 Reputation points Microsoft Employee
    2021-07-02T16:52:36.847+00:00

    Welcome to Azure!

    The short answer is that you can't rename resources (it's a popular request) but there's a lot that can be done during the resource creation process and there is a workaround if you find yourself needing to change the name of a resource group.

    What determines my resource name?
    Typically resources are named based on a name you provide either while configuring the resource or based on the resource group. For example, if you were to create a resource group named "AzureVMQuickstart" and then create a VM in the portal named "MyFirstVM", you'd get the following resources:

    • MyFirstVM (Virtual machine)
    • MyFirstVM-ip (Public IP address)
    • MyFirstVM-nsg (Network security group)
    • AzureVMQuickstart-vnet (Virtual network)
    • MyFirstVM_OSDisk_1h3s4bcc97lw204... (Disk)
    • MyFirstVM-13254 (Network interface)

    There are some exceptions to this rule where you'll see a long string of characters for something but in general it's pretty clear what either the resource group name was or the resource name it was created from.

    How do I change my resource or resource group name?
    Changing the names of resource groups or resources once they've been made is one of the more popular requests that's still outstanding:

    Voting on this helps to improve visibility and priority so I would encourage you to vote if you would like to see these features added.

    While you can't change a resource group name, you can move all of the resources from your old resource group to a new resource group with a new name. This can take some time, however, and isn't recommended as part of a normal workflow.

    This is a good writeup on how to move resources from one resource group to another from Steve Sherry:
    https://adamtheautomator.com/rename-azure-resource-group/

    As well as another simple CLI/PowerShell example along with an explanation on why this happens by Matthias Güntert:
    https://www.azureblue.io/how-to-rename-an-azure-resource-group/

    As far as resources are concerned, unfortunately those cannot be renamed at this time. Most often you do have some degree of control over the name during creation, however, which should help.

    0 comments No comments

  2. SenhorDolas 1,151 Reputation points
    2021-07-12T15:16:03.54+00:00

    @Anonymous
    Sorry, did not see your reply (no alert in my email for some reason)
    Thanks for coming back to me.
    I understand that I cant rename RG and resources but my question was move about the image version naming?
    Since this is created via automation from Azure Image Builder I am guessing it will be an automated name and as such at this stage there is nothing we can do?
    M

    0 comments No comments

  3. kobulloc-MSFT 23,336 Reputation points Microsoft Employee
    2021-07-17T23:24:40.653+00:00

    @SenhorDolas Thank you again for being patient and sorry for the delay. From the documentation regarding the resource group naming convention:

    https://learn.microsoft.com/en-us/azure/virtual-machines/image-builder-overview#how-it-works

    Template configurations can be passed using PowerShell, Az CLI, ARM templates and using the Azure VM Image Builder DevOps task, when you submit it to the service we will create an Image Template Resource. When the Image Template Resource is created you will see a staging resource group created in your subscription, in the format: IT_<DestinationResourceGroup><TemplateName>(GUID). The staging resource group contains files and scripts referenced in the File, Shell, PowerShell customization in the ScriptURI property.

    As for the resources and templates, there are a couple key steps regarding naming (using CLI on Windows here as an example):

    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/image-builder#set-variables

    # Resource group name - we are using myImageBuilderRG in this example  
    imageResourceGroup=myWinImgBuilderRG  
      
    # Name for the image   
    imageName=myWinBuilderImage  
    

    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/image-builder#create-the-image

    (Paying attention to the value for -n)

    az resource create \  
        --resource-group $imageResourceGroup \  
        --properties @helloImageTemplateWin.json \  
        --is-full-object \  
        --resource-type Microsoft.VirtualMachineImages/imageTemplates \  
        -n helloImageTemplateWin01  
    

    Let me know if you need more detail here. Additionally, there are some resources that might help (I usually recommend going through the docs when you are first learning about a service):


  4. Schroeder, Michael (CTR) 26 Reputation points
    2022-04-28T16:38:59.307+00:00

    The answer to this question can be found here: https://github.com/MicrosoftDocs/azure-docs/issues/89180#issuecomment-1063218290

    Version is specified in the GalleryImageId property of the "distribute" block. Use one of two formats:

    -> Automatic versioning - This is the automatic version number you are seeing. The format is:
    /subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Compute/galleries/<sharedImageGalleryName>/images/<imageGalleryName>

    -> Explicit versioning - This is what you're after. It allows you to specify the version number. The format is:
    /subscriptions/<subscriptionID>/resourceGroups/<rgName>/providers/Microsoft.Compute/galleries/<sharedImageGalName>/images/<imageDefName>/versions/<version - for example: 1.1.1>

    0 comments No comments

  5. SenhorDolas 1,151 Reputation points
    2022-05-06T11:15:00.053+00:00

    Hi Everyone,

    I see that there is a way of specifying Image version name via json but is there a way for the "Azure VM Image Builder Task" which I use from DevOps?

    On a separate note, how do I create a json script based on what I have setup in AIB task? I really don't know how to make the transition which I think I need to cos the task is very limited?

    Thanks Everyone

    0 comments No comments