-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
When I try to create a new load balancer and specifically use the tag "subnet" i get the error "incorrect usage: --subnet NAME"
Related command
#CreatingTheResourceGroup
$Location="westus2"
$ResourceGroup="WebSiteUS"
az group create --location $Location --name $ResourceGroup

#Creating the VNET
az network vnet create --name "VNET" --resource-group $ResourceGroup --location $Location --enable-encryption false --ddos-protection false --subnet-name "Predeterminado" --subnet-prefixes "10.0.0.0/24"
az network vnet subnet create --name "AzureBastionSubnet" --resource-group $ResourceGroup --vnet-name "VNET" --address-prefixes "10.0.1.0/26"

#Creating the NIC
az network public-ip create --name "VM" --resource-group $ResourceGroup --location $Location --version "Ipv4" --sku "Standard" --zone 1 --tier "Regional" --dns-name "mio" --dns-name-scope "NoReuse" --ddos-protection-mode "Disabled"
az network nic create --name "NIC" --resource-group $ResourceGroup --vnet-name "VNET" --subnet "Predeterminado" --location $Location --private-ip-address-version "IPv4" --private-ip-address "10.0.0.4" --public-ip-address "VM"

#Creating the NSG and athaching to VNET and NIC
az network nsg create --name "NSG" --resource-group $ResourceGroup --location $Location

az network nsg rule create --name "AllowAnyRDPInbound" --nsg-name "NSG" --resource-group $ResourceGroup --source-port-ranges "" --destination-port-ranges 3389 --protocol "Tcp" --access "Allow" --priority 100
az network nsg rule create --name "AllowAnyHTTPInbound" --nsg-name "NSG" --resource-group $ResourceGroup --source-port-ranges "" --destination-port-ranges 80 --protocol "Tcp" --access "Allow" --priority 110
az network nic update --name "NIC" --resource-group $ResourceGroup --network-security-group "NSG"
az network vnet subnet update --vnet-name "VNET" --name "Predeterminado" --resource-group $ResourceGroup --network-security-group "NSG"

#Creating the NAT
az network public-ip create --name "NAT" --resource-group $ResourceGroup --location $Location --version "Ipv4" --sku "Standard" --zone 1 --tier "Regional" --dns-name "mio" --dns-name-scope "NoReuse" --ddos-protection-mode "Disabled"
az network nat gateway create --name "NAT" --resource-group $ResourceGroup --location $Location --public-ip-addresses "NAT" --zone 1

#Creating the LoadBalancer
az network public-ip create --name "BalancerIP" --resource-group $ResourceGroup --location $Location --version "Ipv4" --sku "Standard" --zone 1 --tier "Regional" --dns-name "mio" --dns-name-scope "NoReuse" --ddos-protection-mode "Disabled"
az network lb create --name "Balancer" --resource-group $ResourceGroup --location $Location --sku "Standard" --frontend-ip-name "IpConfFront" --private-ip-address-version "IPv4" --public-ip-address "BalancerIP" --vnet-name "VNET" --subnet "Predeterminado"

Errors
incorrect usage: --subnet NAME --vnet-name NAME | --subnet ID | --public-ip-address NAME_OR_ID

Issue script & Debug output
cli.knack.cli: Command arguments: ['network', 'lb', 'create', '--name', 'Balancer', '--resource-group', 'WebSiteUS', '--location', 'westus2', '--sku', 'Standard', '--frontend-ip-name', 'IpConfFront', '--private-ip-address-version', 'IPv4', '--public-ip-address', 'BalancerIP', '--vnet-name', 'VNET', '--subnet', 'Predeterminado', '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
Enable VT mode.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x020519D8>, <function OutputProducer.on_global_arguments at 0x02193578>, <function CLIQuery.on_global_arguments at 0x02199078>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'network': ['azure.cli.command_modules.network', 'azure.cli.command_modules.privatedns']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: network 0.925 124 486
cli.azure.cli.core: privatedns 0.036 14 60
cli.azure.cli.core: Total (2) 0.960 138 546
cli.azure.cli.core: Loaded 137 groups, 546 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : network lb create
cli.azure.cli.core: Command table: network lb create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x04129348>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\JohnMayorga18.azure\commands\2024-12-23.21-08-53.network_lb_create.9960.log'.
az_command_data_logger: command args: network lb create --name {} --resource-group {} --location {} --sku {} --frontend-ip-name {} --private-ip-address-version {} --public-ip-address {} --vnet-name {} --subnet {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x04150028>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x04150078>, <function register_cache_arguments..add_cache_arguments at 0x041780C8>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x04178118>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x021935C8>, <function CLIQuery.handle_query_parameter at 0x021990C8>, <function register_ids_argument..parse_ids_arguments at 0x04178078>]
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/invocation.py", line 111, in _validation
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 911, in _validate_cmd_level
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/network/_validators.py", line 560, in process_lb_create_namespace
ValueError: incorrect usage: --subnet NAME --vnet-name NAME | --subnet ID | --public-ip-address NAME_OR_ID
cli.azure.cli.core.azclierror: incorrect usage: --subnet NAME --vnet-name NAME | --subnet ID | --public-ip-address NAME_OR_ID
az_command_data_logger: incorrect usage: --subnet NAME --vnet-name NAME | --subnet ID | --public-ip-address NAME_OR_ID
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x04129488>]
az_command_data_logger: exit code: 2
cli.main: Command ran in 1.447 seconds (init: 0.403, invoke: 1.044)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3919 in cache file under C:\Users\JohnMayorga18.azure\telemetry\20241223210853457
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry_init_.pyc C:\Users\JohnMayorga18.azure C:\Users\JohnMayorga18.azure\telemetry\20241223210853457"
telemetry.process: Return from creating process 12164
telemetry.main: Finish creating telemetry upload process.
Expected behavior
The expected behavior is creating a new LoadBalancer using AzCLI and atach that LoadBalancer to the Subnet on the created VNET.
Environment Summary
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> az --version
azure-cli 2.67.0
core 2.67.0
telemetry 1.1.0
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\JohnMayorga18.azure\cliextensions'
Python (Windows) 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 02:44:45) [MSC v.1941 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
There is not an error if I quit the tag "--subnet", the command is executed successfully.
But I tried to use the AzureID for that subnet and I get the same error and I have verified that the VNET and Subnet on that VNET has on the same region and I checked the names 3 times.
So on that documentation says when I use the parameter --subnet I must to reference to VNET and FrontIP
