01 Run account list command (Windows/macOS/Linux) with custom output filters to list the IDs of the cloud subscriptions available in your Azure cloud account:
az account list
--query '[*].id'
02 The command output should return the requested subscription identifiers (IDs):
[
"abcdabcd-1234-abcd-1234-abcdabcdabcd",
"abcd1234-abcd-1234-abcd-abcd1234abcd"
]
03 Run account set command (Windows/macOS/Linux) with the ID of the Azure cloud subscription that you want to examine as the identifier parameter to set the selected subscription to be the current active subscription (the command does not produce an output):
az account set
--subscription abcdabcd-1234-abcd-1234-abcdabcdabcd
04 Run network vnet create command (Windows/macOS/Linux) to create the Azure Virtual Network (and the AzureBastionSubnet subnet) required for your Bastion host:
az network vnet create
--resource-group cloud-shell-storage-westeurope
--location westeurope
--name cc-project5-bastion-vnet
--address-prefixes 10.0.0.0/16
--subnet-name AzureBastionSubnet
--subnet-prefixes 10.0.1.0/26
05 The command output should return the configuration information available for the new Azure VNet:
{
"newVNet": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"enableDdosProtection": false,
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/virtualNetworks/cc-project5-bastion-vnet",
"location": "westeurope",
"name": "cc-project5-bastion-vnet",
"provisioningState": "Succeeded",
"resourceGroup": "cloud-shell-storage-westeurope",
"subnets": [
{
"addressPrefix": "10.0.1.0/26",
"delegations": [],
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/virtualNetworks/cc-project5-bastion-vnet/subnets/AzureBastionSubnet",
"name": "AzureBastionSubnet",
"privateEndpointNetworkPolicies": "Disabled",
"privateLinkServiceNetworkPolicies": "Enabled",
"provisioningState": "Succeeded",
"resourceGroup": "cloud-shell-storage-westeurope",
"type": "Microsoft.Network/virtualNetworks/subnets"
}
],
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": []
}
}
06 Run network public-ip create command (Windows/macOS/Linux) to create the public IP address to be used within the frontend IP configuration of the Bastion host:
az network public-ip create
--resource-group cloud-shell-storage-westeurope
--name cc-project5-bastion-ip
--sku Standard
--zone 1 2 3
07 The command output should return the configuration information available for the new public IP address:
{
"publicIp": {
"ddosSettings": {
"protectionMode": "VirtualNetworkInherited"
},
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/publicIPAddresses/cc-project5-bastion-ip",
"idleTimeoutInMinutes": 4,
"ipAddress": "xxx.xxx.xxx.xxx",
"ipTags": [],
"location": "westeurope",
"name": "cc-project5-bastion-ip",
"provisioningState": "Succeeded",
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Static",
"resourceGroup": "cloud-shell-storage-westeurope",
"sku": {
"name": "Standard",
"tier": "Regional"
},
"type": "Microsoft.Network/publicIPAddresses",
"zones": [
"1",
"2",
"3"
]
}
}
08 Run network bastion create command (Windows/macOS/Linux) to create your new Azure Bastion host machine using the Virtual Network (VNet) and public IP address provisioned in the previous steps:
az network bastion create
--subscription abcdabcd-1234-abcd-1234-abcdabcdabcd
--resource-group cloud-shell-storage-westeurope
--name cc-project5-bastion-host
--public-ip-address cc-project5-bastion-ip
--vnet-name cc-project5-bastion-vnet
--location westeurope
--scale-units 2
--sku Standard
09 The command output should return the configuration information available for your new Bastion host:
{
"disableCopyPaste": false,
"dnsName": "abc-abcdabcd-1234-abcd-1234-abcdabcdabcd.bastion.azure.com",
"enableIpConnect": false,
"enableTunneling": false,
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/bastionHosts/cc-project5-bastion-host",
"ipConfigurations": [
{
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/bastionHosts/cc-project5-bastion-host/bastionHostIpConfigurations/bastion_ip_config",
"name": "bastion_ip_config",
"privateIPAllocationMethod": "Dynamic",
"provisioningState": "Succeeded",
"publicIPAddress": {
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/publicIPAddresses/cc-project5-bastion-ip",
"resourceGroup": "cloud-shell-storage-westeurope"
},
"resourceGroup": "cloud-shell-storage-westeurope",
"subnet": {
"id": "/subscriptions/abcdabcd-1234-abcd-1234-abcdabcdabcd/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/virtualNetworks/cc-project5-bastion-vnet /subnets/AzureBastionSubnet",
"resourceGroup": "cloud-shell-storage-westeurope"
},
"type": "Microsoft.Network/bastionHosts/bastionHostIpConfigurations"
}
],
"location": "westeurope",
"name": "cc-project5-bastion-host",
"provisioningState": "Succeeded",
"resourceGroup": "cloud-shell-storage-westeurope",
"scaleUnits": 2,
"sku": {
"name": "Standard"
},
"type": "Microsoft.Network/bastionHosts"
}
10 Repeat steps no. 4 – 9 for each subscription available in your Microsoft Azure cloud account.