azureazure-virtual-networkbastion-host

Unable to connect through virtual machine via Azure Bastion


I am facing some issue in connecting to Virtual Machine through Azure Bastion. I am getting the below error

Bastion is in failed state. Please delete and recreate it.

Could you please let me know why I am getting the above error message and can anyone please suggest me a workaround for this.


Solution

  • The error could happen when the Azure Bastion does not make provision well or you are deleting the Bastion service(it takes a few minutes to delete the service).

    After Bastion has been deployed to the virtual network, the screen changes to the connect page.

    enter image description here

    In this case, you could delete the failed Bastion service. I suggest re-creating an Azure Bastion Host with Azure PowerShell or CLI to avoid some portal issues.

    For example

    # create an AzureBastionSubnet in your Azure VNet.
    az network vnet create -g $RgName -n $VNetName  --address-prefix 10.0.0.0/16 --subnet-name AzureBastionSubnet  --subnet-prefix 10.0.0.0/24
    
    # create a public IP address. The public IP address must be in the same region as the Bastion resource you are creating.
    az network public-ip create -g $RgName -n $publicip --sku Standard
    
    # create a bastion host in the same region as your VM
    az network bastion create --name $name --public-ip-address $publicip --resource-group $RgName --vnet-name $VNetName --location $location
    

    It takes about 5 minutes for the Bastion resource to create and deploy. Please be patient.