azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

New-AzVM installs BGInfo extension automatically

Open kegregoi opened this issue 1 year ago • 6 comments

Description

When creating a new VM with 'New-AzVM' it will also install the BGInfo extension automatically

This will only happen if the '-VM' parameter is used to pass a virtual machine object. Even though BGInfo was not specified in the virtual machine object New-AzVM -ResourceGroupName $rgname -Location $loc -VM $vmconfig

However, if you don't use the '-VM' parameter, then instead New-AzVM chooses default parameters and BGInfo is NOT installed New-AzVM -ResourceGroupName $rgname -Location $loc' -Name VMname

You can see it here in New-AzVM source - https://github.com/Azure/azure-powershell/blob/452b2d747938bf63361214f840baa35a114f2c95/src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs#L1195

The workaround is to use -DisableBginfoExtension, but that shouldn't be necessary since -VM isn't supposed to install BGInfo

Can we please change this so BGInfo does not automatically install?

Issue script & Debug output

Debug info was too long so it won't let me submit as it surpasses the character limit. If you need the debug logs please reach out to me internally

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.13.2                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}  
Script     7.1.0                 Az.Compute                          {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Ad… 
Script     7.1.0                 Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationG… 
Script     6.12.1                Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, …

Error output

No response

kegregoi avatar Jul 11 '24 21:07 kegregoi

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @TravisCragg-MSFT, @nikhilpatel909, @sandeepraichura, @hilaryw29, @GabstaMSFT.

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @TravisCragg-MSFT, @nikhilpatel909, @sandeepraichura, @hilaryw29, @GabstaMSFT.

@kegregoi This is an behavior left over from when this extension used to be default. We are working now to remove this default.

TravisCragg-MSFT avatar Jul 18 '24 18:07 TravisCragg-MSFT

@TravisCragg-MSFT has this been completed or is this still being worked on? Do we have an estimate for completing it?

kegregoi avatar Oct 22 '24 19:10 kegregoi

@kegregoi This has not been completed, let me get an estimate and get back.

TravisCragg-MSFT avatar Oct 22 '24 19:10 TravisCragg-MSFT

FYI - for anyone stumbling across this issue as I did...

New-AzVM cmdlet now has a -DisableBginfoExtension to disable adding this extension.

https://learn.microsoft.com/en-us/powershell/module/az.compute/new-azvm?view=azps-15.0.0&viewFallbackFrom=azps-1.2.0

pecjag avatar Dec 01 '25 09:12 pecjag