Programmatic Connection to Bastion Server Without Username and Password

Ganesh R 0 Reputation points
2024-07-15T07:45:50.6966667+00:00

Dear Microsoft Support,

I am currently working on automating our connections to a Bastion Server and am looking for a way to connect programmatically without having to manually input the username and password each time. Specifically, I would like to know:

Is it possible to establish a connection to a Bastion Server programmatically without typing the username and password?

If so, what are the recommended methods or best practices for achieving this? Are there any specific APIs, provided by Microsoft that facilitate this kind of connection?

What security considerations should we be aware of when implementing such a solution?

Currently using this method

Get Bastion Shareable link

Thank you for your assistance.

Azure Bastion
Azure Bastion
An Azure service that provides private and fully managed Remote Desktop Protocol (RDP) and Secure Shell (SSH) access to virtual machines.
253 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,334 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ChaitanyaNaykodi-MSFT 25,121 Reputation points Microsoft Employee
    2024-07-15T20:30:59.32+00:00

    @Ganesh R

    I understand you want to know if there is any programmatic way to connect to VM using Azure Bastion without entering the username password. And you are already using the Get Bastion Shareable link.I think you can explore the option of using az network bastion tunnel command to connect to your Azure VM and VS code using Remote SSH extension. You can refer to this tutorial here for more information on implementation.

    Additional Reference:

    https://learn.microsoft.com/en-us/azure/bastion/connect-vm-native-client-windows#tunnel-IP

    If this does not satisfy you requirement, it will help if you could file feedback item with your use case for this request on our feedback portal here

    Hope this helps! Please let me know if you have any additional questions. Thank you!


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.