az network bastion

Note

This reference is part of the bastion extension for the Azure CLI (version 2.43.0 or higher). The extension will automatically install the first time you run an az network bastion command. Learn more about extensions.

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Manage Azure Bastion host machines.

Commands

Name Description Type Status
az network bastion create

Create a Azure Bastion host machine.

Extension Preview
az network bastion delete

Delete a Azure Bastion host machine.

Extension Preview
az network bastion list

List all Azure Bastion host machines.

Extension Preview
az network bastion rdp

RDP to target Virtual Machine using Tunneling from Azure Bastion.

Extension Preview
az network bastion show

Show a Azure Bastion host machine.

Extension Preview
az network bastion ssh

SSH to a virtual machine using Tunneling from Azure Bastion.

Extension Preview
az network bastion tunnel

Open a tunnel through Azure Bastion to a target virtual machine.

Extension Preview
az network bastion update

Update a Azure Bastion host machine.

Extension Preview
az network bastion wait

Place the CLI in a waiting state until a condition is met.

Extension Preview

az network bastion create

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Create a Azure Bastion host machine.

az network bastion create --name
                          --public-ip-address
                          --resource-group
                          --vnet-name
                          [--disable-copy-paste {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-ip-connect {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-tunneling {0, 1, f, false, n, no, t, true, y, yes}]
                          [--location]
                          [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                          [--scale-units]
                          [--sku {Basic, Standard}]
                          [--tags]

Examples

Create a Azure Bastion host machine.

az network bastion create --location westus2 --name MyBastionHost --public-ip-address MyPublicIpAddress --resource-group MyResourceGroup --vnet-name MyVnet

Required Parameters

--name -n

Name of the bastion host.

--public-ip-address

Name or ID of Azure Public IP. The SKU of the public IP must be Standard.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--vnet-name

Name of the virtual network. It must have a subnet called AzureBastionSubnet.

Optional Parameters

--disable-copy-paste

Disable copy and paste for all sessions on this Azure Bastion resource.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
default value: False
--enable-ip-connect

Enable IP-based Connections on this Azure Bastion resource.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
default value: False
--enable-tunneling

Enable Native Client Support on this Azure Bastion resource.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
default value: False
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--no-wait

Do not wait for the long-running operation to finish.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--scale-units

Scale units for the Bastion Host resource with the range of [2, 50].

--sku

SKU of this Bastion Host.

accepted values: Basic, Standard
default value: Standard
--tags

Space-separated tags: key[=value] [key[=value] ...]. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion delete

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Delete a Azure Bastion host machine.

az network bastion delete [--ids]
                          [--name]
                          [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                          [--resource-group]
                          [--subscription]

Examples

Delete a Azure Bastion host machine.

az network bastion delete --name MyBastionHost --resource-group MyResourceGroup

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the bastion host.

--no-wait

Do not wait for the long-running operation to finish.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion list

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

List all Azure Bastion host machines.

az network bastion list [--resource-group]

Examples

List all Azure Bastion host machines.

az network bastion list -g MyResourceGroup

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion rdp

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

RDP to target Virtual Machine using Tunneling from Azure Bastion.

az network bastion rdp [--auth-type]
                       [--configure]
                       [--disable-gateway {false, true}]
                       [--enable-mfa {false, true}]
                       [--ids]
                       [--name]
                       [--resource-group]
                       [--resource-port]
                       [--subscription]
                       [--target-ip-address]
                       [--target-resource-id]

Examples

RDP to virtual machine using Azure Bastion.

az network bastion rdp --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId

RDP to machine using reachable IP address.

az network bastion rdp --name MyBastionHost --resource-group MyResourceGroup --target-ip-address 10.0.0.1

Optional Parameters

--auth-type

Auth type to use for RDP connections.

--configure

Flag to configure RDP session.

default value: False
--disable-gateway

Flag to disable access through RD gateway.

accepted values: false, true
default value: False
--enable-mfa

Enable RDS auth for MFA if supported by the target machine.

accepted values: false, true
default value: False
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the bastion host.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--resource-port

Resource port of the target VM to which the bastion will connect.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target-ip-address

IP address of target Virtual Machine.

--target-resource-id

ResourceId of the target Virtual Machine.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion show

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Show a Azure Bastion host machine.

az network bastion show [--ids]
                        [--name]
                        [--resource-group]
                        [--subscription]

Examples

Show a Azure Bastion host machine.

az network bastion show --name MyBastionHost --resource-group MyResourceGroup

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the bastion host.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion ssh

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

SSH to a virtual machine using Tunneling from Azure Bastion.

az network bastion ssh --auth-type
                       [--ids]
                       [--name]
                       [--resource-group]
                       [--resource-port]
                       [--ssh-key]
                       [--subscription]
                       [--target-ip-address]
                       [--target-resource-id]
                       [--username]

Examples

SSH to virtual machine using Azure Bastion using password.

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type password --username xyz

SSH to virtual machine using Azure Bastion using ssh key file.

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type ssh-key --username xyz --ssh-key C:/filepath/sshkey.pem

SSH to virtual machine using Azure Bastion using AAD.

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type AAD

SSH to virtual machine using Azure Bastion using AAD.

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type AAD

Required Parameters

--auth-type

Auth type to use for SSH connections.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the bastion host.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--resource-port

Resource port of the target VM to which the bastion will connect.

--ssh-key

SSH key file location for SSH connections.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target-ip-address

IP address of target Virtual Machine.

--target-resource-id

ResourceId of the target Virtual Machine.

--username

User name for SSH connections.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion tunnel

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Open a tunnel through Azure Bastion to a target virtual machine.

az network bastion tunnel --port
                          --resource-port
                          [--ids]
                          [--name]
                          [--resource-group]
                          [--subscription]
                          [--target-ip-address]
                          [--target-resource-id]
                          [--timeout]

Examples

Open a tunnel through Azure Bastion to a target virtual machine using resourceId.

az network bastion tunnel --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --resource-port 22 --port 50022

Open a tunnel through Azure Bastion to a target virtual machine using its IP address.

az network bastion tunnel --name MyBastionHost --resource-group MyResourceGroup --target-ip-address 10.0.0.1 --resource-port 22 --port 50022

Required Parameters

--port

Local port to use for the tunneling.

--resource-port

Resource port of the target VM to which the bastion will connect.

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the bastion host.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target-ip-address

IP address of target Virtual Machine.

--target-resource-id

ResourceId of the target Virtual Machine.

--timeout

Timeout for connection to bastion host tunnel.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion update

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Update a Azure Bastion host machine.

az network bastion update [--add]
                          [--disable-copy-paste {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-ip-connect {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-tunneling {0, 1, f, false, n, no, t, true, y, yes}]
                          [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                          [--ids]
                          [--name]
                          [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                          [--remove]
                          [--resource-group]
                          [--scale-units]
                          [--set]
                          [--sku {Basic, Standard}]
                          [--subscription]

Examples

Update a Azure Bastion host machine to enable native client support.

az network bastion update --name MyBastionHost --resource-group MyResourceGroup --enable-tunneling

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--disable-copy-paste

Disable copy and paste for all sessions on this Azure Bastion resource.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--enable-ip-connect

Enable IP-based Connections on this Azure Bastion resource.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--enable-tunneling

Enable Native Client Support on this Azure Bastion resource.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the bastion host.

--no-wait

Do not wait for the long-running operation to finish.

accepted values: 0, 1, f, false, n, no, t, true, y, yes
--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--scale-units

Scale units for the Bastion Host resource with the range of [2, 50].

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--sku

SKU of this Bastion Host.

accepted values: Basic, Standard
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az network bastion wait

Preview

Command group 'az network' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Place the CLI in a waiting state until a condition is met.

az network bastion wait [--created]
                        [--custom]
                        [--deleted]
                        [--exists]
                        [--ids]
                        [--interval]
                        [--name]
                        [--resource-group]
                        [--subscription]
                        [--timeout]
                        [--updated]

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

default value: False
--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

default value: False
--exists

Wait until the resource exists.

default value: False
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--interval

Polling interval in seconds.

default value: 30
--name -n

Name of the bastion host.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.

default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.