Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
New-AzBastion
- Module:
- Az.Network Module
Creates a bastion resource.
Syntax
ByPublicIpAddressByVirtualNetwork (Default)
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddress <PSPublicIpAddress>
-VirtualNetwork <PSVirtualNetwork>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressByVirtualNetworkRGNameByVirtualNetworkName
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddress <PSPublicIpAddress>
-VirtualNetworkRgName <String>
-VirtualNetworkName <String>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressByVirtualNetworkId
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddress <PSPublicIpAddress>
-VirtualNetworkId <String>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressIdByVirtualNetwork
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddressId <String>
-VirtualNetwork <PSVirtualNetwork>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressIdByVirtualNetworkRGNameByVirtualNetworkName
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddressId <String>
-VirtualNetworkRgName <String>
-VirtualNetworkName <String>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressIdByVirtualNetworkId
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddressId <String>
-VirtualNetworkId <String>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressRgNameByPublicIpAddressNameByVirtualNetwork
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddressRgName <String>
-PublicIpAddressName <String>
-VirtualNetwork <PSVirtualNetwork>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressRgNameByPublicIpAddressNameByVirtualNetworkRGNameByVirtualNetworkName
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddressRgName <String>
-PublicIpAddressName <String>
-VirtualNetworkRgName <String>
-VirtualNetworkName <String>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByPublicIpAddressRgNameByPublicIpAddressNameByVirtualNetworkId
New-AzBastion
-ResourceGroupName <String>
-Name <String>
-PublicIpAddressRgName <String>
-PublicIpAddressName <String>
-VirtualNetworkId <String>
[-Sku <String>]
[-ScaleUnit <Int32>]
[-EnableKerberos <Boolean>]
[-DisableCopyPaste <Boolean>]
[-EnableTunneling <Boolean>]
[-EnableIpConnect <Boolean>]
[-EnableShareableLink <Boolean>]
[-EnableSessionRecording <Boolean>]
[-AsJob]
[-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Creates a bastion resource.This will need a Public Ip Address and a VirtualNetwork. There must be a subnet with name AzureBastionSubnet in this VirtualNetwork.The Pubic Ip Address must be created with Sku Standard.
Examples
Example 1
$subnetName = "AzureBastionSubnet"
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24
$vnet = New-AzVirtualNetwork -Name "TestVnet" -ResourceGroupName "BastionPowershellTest" -Location "westeurope" -AddressPrefix 10.0.0.0/16 -Subnet $subnet
$publicip = New-AzPublicIpAddress -ResourceGroupName "BastionPowershellTest" -Name "Test-Ip" -location "westeurope" -AllocationMethod Dynamic -Sku Standard
$bastion = New-AzBastion -ResourceGroupName "BastionPowershellTest" -Name "test-Bastion2" -PublicIpAddress $publicip -VirtualNetwork $vnet
IpConfigurations : {IpConf}
DnsName : bst-a9ca868f-ddab-4a50-9f45-a443ea8a0187.bastion.azure.com
ProvisioningState : Succeeded
IpConfigurationsText : [
{
"Subnet": {
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/virtualNetworks/TestVnet/subnets/AzureBastionSubnet"
},
"PublicIpAddress": {
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/publicIPAddresses/Test-Ip"
},
"ProvisioningState": "Succeeded",
"PrivateIpAllocationMethod": "Dynamic",
"Name": "IpConf",
"Etag": "W/\"ed810ccd-b3f6-4e22-891e-b0ed0a26d6dd\"",
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/test-Bastion2/bastionHostIpConfigurations/IpConf"
}
]
ResourceGroupName : BastionPowershellTest
Location : westeurope
ResourceGuid :
Type : Microsoft.Network/bastionHosts
Tag :
TagsTable :
Name : test-Bastion2
Etag : W/"ed810ccd-b3f6-4e22-891e-b0ed0a26d6dd"
Id : /subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/test-Bastion2
Sku : {
"Name": "Basic"
}
Scale Units : 2
This example creates a bastion attached to virtual network "vnet" in the same resource group as the bastion. There must be a subnet with name AzureBastionSubnet in this vnet. The Ip Address must be created with Sku Standard.
Example 2
$vnet = Get-AzVirtualNetwork -ResourceGroupName "BastionPowershellTest" -Name "testVnet2"
Add-AzVirtualNetworkSubnetConfig -Name "AzureBastionSubnet" -VirtualNetwork $vnet -AddressPrefix "10.0.0.0/24"
$vnet| Set-AzVirtualNetwork
New-AzBastion -ResourceGroupName "BastionPowershellTest" -Name "testBastion2" -PublicIpAddressRgName "BastionPowershellTest" -PublicIpAddressName "testIp2" -VirtualNetworkRgName "BastionPowershellTest" -VirtualNetworkName "testVnet2"
IpConfigurations : {IpConf}
DnsName : bst-53757658-c4fd-4908-b1a7-0849e555d489.bastion.azure.com
ProvisioningState : Succeeded
IpConfigurationsText : [
{
"Name": "IpConf",
"Etag": "W/\"7460e5f6-ad41-438b-a595-a63346ed8f16\"",
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2/bastionHostIpConfigurations/IpConf",
"Subnet": {
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/virtualNetworks/testVnet2/subnets/AzureBastionSubnet"
},
"PublicIpAddress": {
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/publicIPAddresses/testIp2"
},
"ProvisioningState": "Succeeded",
"PrivateIpAllocationMethod": "Dynamic"
}
]
ResourceGroupName : BastionPowershellTest
Location : westeurope
ResourceGuid :
Type : Microsoft.Network/bastionHosts
Tag :
TagsTable :
Name : testBastion2
Etag : W/"7460e5f6-ad41-438b-a595-a63346ed8f16"
Id : /subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2
Sku : {
"Name": "Basic"
}
Scale Units : 2
Example 3
$vnet = Get-AzVirtualNetwork -ResourceGroupName "BastionPowershellTest" -Name "testVnet2"
Add-AzVirtualNetworkSubnetConfig -Name "AzureBastionSubnet" -VirtualNetwork $vnet -AddressPrefix "10.0.0.0/24"
$vnet| Set-AzVirtualNetwork
New-AzBastion -ResourceGroupName "BastionPowershellTest" -Name "testBastion2" -PublicIpAddressRgName "BastionPowershellTest" -PublicIpAddressName "testIp2" -VirtualNetworkRgName "BastionPowershellTest" -VirtualNetworkName "testVnet2" -Sku "Standard" -ScaleUnit 3
IpConfigurations : {IpConf}
DnsName : bst-53757658-c4fd-4908-b1a7-0849e555d489.bastion.azure.com
ProvisioningState : Succeeded
IpConfigurationsText : [
{
"Name": "IpConf",
"Etag": "W/\"7460e5f6-ad41-438b-a595-a63346ed8f16\"",
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2/bastionHostIpConfigurations/IpConf",
"Subnet": {
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/virtualNetworks/testVnet2/subnets/AzureBastionSubnet"
},
"PublicIpAddress": {
"Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/publicIPAddresses/testIp2"
},
"ProvisioningState": "Succeeded",
"PrivateIpAllocationMethod": "Dynamic"
}
]
ResourceGroupName : BastionPowershellTest
Location : westeurope
ResourceGuid :
Type : Microsoft.Network/bastionHosts
Tag :
TagsTable :
Name : testBastion2
Etag : W/"7460e5f6-ad41-438b-a595-a63346ed8f16"
Id : /subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2
Sku : {
"Name": "Standard"
}
Scale Units : 3
This example creates a BastionHost resource with Standard Sku and 3 Scale Units.
Parameters
-AsJob
Run cmdlet in the background
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-DisableCopyPaste
Copy and Paste
Parameter properties
| Type: | |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnableIpConnect
IP Connect
Parameter properties
| Type: | |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnableKerberos
Kerberos
Parameter properties
| Type: | |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnableSessionRecording
Session Recording
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnableShareableLink
Shareable Link
Parameter properties
| Type: | |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-EnableTunneling
Native Client
Parameter properties
| Type: | |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
The bastion resource name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ResourceName, BastionName |
Parameter sets
-PublicIpAddress
The public IP address object for bastion.
Parameter properties
| Type: | PSPublicIpAddress |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | PublicIpAddressObject |
Parameter sets
-PublicIpAddressId
The public Ip address Azure resource Id for bastion.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | PublicIpAddressResourceId |
Parameter sets
-PublicIpAddressName
The public Ip address resource name for bastion.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PublicIpAddressRgName
The public Ip address resource group name for bastion.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | PublicIpAddressResourceGroupName |
Parameter sets
-ResourceGroupName
The resource group name where you need to create bastion.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ScaleUnit
The Scale Units for BastionHost
Parameter properties
| Type: | |
| Default value: | 2 |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Sku
The Bastion Sku Tier
Parameter properties
| Type: | String |
| Default value: | Basic |
| Accepted values: | Basic, Standard, Premium |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Tag
A hashtable which represents resource tags.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-VirtualNetwork
The virtual network object for bastion.
Parameter properties
| Type: | PSVirtualNetwork |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | VirtualNetworkObject |
Parameter sets
-VirtualNetworkId
The virtual network Azure resource Id for bastion.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | VirtualNetworkResourceId |
Parameter sets
-VirtualNetworkName
The virtual network resource name for bastion.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-VirtualNetworkRgName
The virtual network resource group name for bastion.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | VirtualNetworkResourceGroupName |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
String
Nullable<T>
Nullable<T>
Outputs
PSBastion
Related Links
Azure PowerShell
Feedback
Was this page helpful?
