Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.22k stars 3.83k forks source link

Unable to deploy basic Bastion SKU #25078

Open ld0614 opened 3 months ago

ld0614 commented 3 months ago

Description

When running the command New-AzBastion -ResourceGroupName $VNetRG -Name "$VNetName-bastion" -PublicIpAddressRgName $ResourceGroupName -PublicIpAddressName $BastionPIPName -VirtualNetworkRgName $VNetRG -VirtualNetworkName $VNetName -Sku "Basic"

I get the error

New-AzBastion: Bastion scalable host is available on Standard SKU

As you can see from the above the -Sku is set to Basic and I am not explicitly setting the -ScaleUnit parameter which suggests that a default value is being included somewhere or validation can't handle $null correctly.

I've tried setting -ScaleUnit to 0 and $null without any change in the error message

Happy to provide more info/logs if relevant

Issue script & Debug output

Most data removed to avoid sensitive information, from what I was reading it just covered auth and successfully finding pre-req resources

DEBUG: 15:23:43 - NewAzBastionCommand begin processing with ParameterSet 'ByPublicIpAddressRgNameByPublicIpAddressNameByVirtualNetworkRGNameByVirtualNetworkName'.

Body:
{
  "error": {
    "code": "ResourceNotFound",
    "message": "The Resource 'Microsoft.Network/bastionHosts/bastion' under resource group 'ResourceGroup' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"
  }
}

DEBUG: 15:23:54 - [ConfigManager] Got nothing from [EnableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
New-AzBastion: Bastion scalable host is available on Standard SKU
DEBUG: 15:23:54 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 15:23:54 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 15:23:54 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Network:7.6.0; CommandName: New-AzBastion; PSVersion: 7.4.2; IsSuccess: False; Duration: 00:00:03.9684244; SanitizeDuration: 00:00:00; Exception: Bastion scalable host is available on Standard SKU;
DEBUG: 15:23:54 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 15:23:54 - NewAzBastionCommand end processing.

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                                
Script     8.0.0                 Az.Compute                       
Script     7.6.0                 Az.Network                          
Script     7.1.0                 Az.Resources                        
Script     7.0.0                 Az.Storage

Error output

Message        : Bastion scalable host is available on Standard SKU
StackTrace     :    at Microsoft.Azure.Commands.Network.Bastion.BastionBaseCmdlet.ValidateScaleUnits(PSBastion bastion, Nullable`1 scaleUnits)
                    at Microsoft.Azure.Commands.Network.Bastion.NewAzBastionCommand.CreateBastion()
                    at Microsoft.Azure.Commands.Network.Bastion.NewAzBastionCommand.<Execute>b__76_0()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ConfirmAction(String processMessage, String target, Action action)  
                    at Microsoft.Azure.Commands.Network.Bastion.NewAzBastionCommand.Execute()
                    at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentException
InvocationInfo : {New-AzBastion}
Line           :         New-AzBastion -ResourceGroupName $VNetRG -Name "$VNetName-bastion" -PublicIpAddressRgName $ResourceGroupName
                 -PublicIpAddressName $BastionPIPName -VirtualNetworkRgName $VNetRG -VirtualNetworkName $VNetName -Sku "Basic" -Debug
Position       : At line:1 char:9
                 +         New-AzBastion -ResourceGroupName $VNetRG -Name "$VNetName-bas …
                 +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 108
microsoft-github-policy-service[bot] commented 3 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @bastionsuppgithub.

microsoft-github-policy-service[bot] commented 3 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @bastionsuppgithub.

tbisque commented 3 months ago

@ld0614 I ran into this same issue, and found your GH issue here. If you're still experiencing this, I was able to work around it by just not providing the -Sku parameter. Its value is Basic by default, if not provided, according to this learn article.

Obviously not proposing it as a permanent solution, but seems to have worked for me!

ld0614 commented 3 months ago

Thanks @tbisque it's most appreciated!

tbisque commented 3 months ago

@ld0614, I spoke too soon. Omitting the -Sku parameter created a standard tier bastion (in Azure US Government at least) :(