Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

How to specify the resource group used by AIB? #61

Open
MS-KenXu opened this issue Jul 24, 2020 · 3 comments
Open

How to specify the resource group used by AIB? #61

MS-KenXu opened this issue Jul 24, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@MS-KenXu
Copy link

MS-KenXu commented Jul 24, 2020

I am currently working with AIB in a restricted subscription where resource groups (RG) must be created with special tags. This rule fails AIB every time because it tries to create new RG without those tags.

My question is, is there any way to specify tags for RG that AIB creates? More ideally, can AIB use existing RG to operate?

Thank you!

@danielsollondon
Copy link
Owner

Hi @MS-KenXu - this is on our backlog. Do you have a time window where you can apply tags to the staging resource group? If so, you can do something like:

Adding Tags

Staging resource group will be IT___guid, sometimes the names can be truncated. The script below will appends tags, you must not remove the existing ones.

# Submit template
New-AzResourceGroupDeployment -ResourceGroupName $imageResourceGroup -TemplateFile $templateFilePath -api-version "2020-02-14" -imageTemplateName $imageTemplateName -svclocation $location
 
# Add tags
$imageResourceGroup="aibImageRG000033"
$imageTemplateName="davecesarworking"
$location="westus2"
 
$resourceGroupName=Get-AzResourceGroup -Location $location| Where ResourceGroupName -like IT_$imageResourceGroup"_"$imageTemplateName*
$Tags = (Get-AzResourceGroup -Name $resourceGroupName.ResourceGroupName).Tags
$Tags += @{"Status5"="Approved"}
Set-AzResourceGroup -Name $resourceGroupName.ResourceGroupName -Tag $Tags
# Submit template
az resource create \
    --resource-group $imageResourceGroup \
    --properties @helloImageTemplateLinux.json \
    --is-full-object \
    --resource-type Microsoft.VirtualMachineImages/imageTemplates \
    -n helloImageTemplateLinux01
 
# Add tags
imageResourceGroup="aibImageRG000033"
imageTemplateName="davecesarworking"
 
resourceGroupName=$(az group list --query "[?contains(name, 'IT_$imageResourceGroup"_"$imageTemplateName')].[name]" --output tsv)
 
az group update --resource-group $resourceGroupName --set tags.Status3=Approved

@danielsollondon danielsollondon added the enhancement New feature or request label Aug 12, 2020
@MS-KenXu
Copy link
Author

Hi @danielsollondon , thank you for the reply! The staging RG will be created with the template together, so the the command $ az resource create will fail at the first hand. Is there any way to pass tags as creation parameter for staging RG?

@kof-f
Copy link

kof-f commented Oct 19, 2021

Hey All,

I'm Kofi and I'm currently the PM for Azure Image Builder. Dan has transitioned to another team.

We are aware of the need to specify the staging RG AIB utilizes for the image build. This feature is tentatively expected by the end of Q1 2022. We are deprecating this repo soon, so in the future please leave any issues/feature requests in our official repo: https://github.com/Azure/azvmimagebuilder

Thank you for your interest in our service!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants