{"componentChunkName":"component---src-templates-post-template-js","path":"/azure-bastion-tutorial-en","result":{"data":{"markdownRemark":{"id":"cdbae66c-3634-5043-a8e3-6b394db823b0","html":"<blockquote>\n<p>This page has been machine-translated from the <a href=\"/azure-bastion-tutorial\">original page</a>.</p>\n</blockquote>\n<p>While studying for AZ-500, I learned that Azure Bastion lets you remotely access Azure VMs over RDP or SSH without assigning them a public IP address.</p>\n<p>I also learned that Azure Bastion lets you operate them from the Azure portal without connecting the host directly to the VM, so I felt I had to try building it right away.</p>\n<p>In this article, I summarize my notes from setting up an environment that allows remote access with Azure Bastion.</p>\n<!-- omit in toc -->\n<h2 id=\"table-of-contents\" style=\"position:relative;\"><a href=\"#table-of-contents\" aria-label=\"table of contents permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Table of Contents</h2>\n<ul>\n<li><a href=\"#what-is-azure-bastion\">What is Azure Bastion?</a></li>\n<li><a href=\"#create-a-virtual-network-and-subnet\">Create a virtual network and subnet</a></li>\n<li><a href=\"#create-virtual-machines\">Create virtual machines</a></li>\n<li><a href=\"#deploy-bastion-to-the-virtual-network-easy-setup\">Deploy Bastion to the virtual network (easy setup)</a></li>\n<li><a href=\"#deploy-bastion-to-the-virtual-network-custom\">Deploy Bastion to the virtual network (custom)</a></li>\n<li><a href=\"#remote-access-to-a-virtual-machine-with-a-native-client\">Remote access to a virtual machine with a native client</a></li>\n<li><a href=\"#summary\">Summary</a></li>\n</ul>\n<h2 id=\"what-is-azure-bastion\" style=\"position:relative;\"><a href=\"#what-is-azure-bastion\" aria-label=\"what is azure bastion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is Azure Bastion?</h2>\n<p>Azure Bastion is a fully managed service that is deployed into a virtual network and enables RDP and SSH connections to Azure VMs.</p>\n<p>With Azure Bastion, you can securely access Azure VMs through Bastion without assigning a public IP address to the VMs themselves.</p>\n<p>Another very nice point is that you can remotely control a virtual machine from the Azure portal without making an RDP or SSH connection from the host machine.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 905px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/028f4a1a7c4ef63d480eccf7aba7948b/65d79/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 56.25%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAACXBIWXMAAAsTAAALEwEAmpwYAAABuklEQVQoz3VT227VMBDM//8CqE8g9SN4r6oiAVJbIcFDb5yGoyTOxY7vGWbtc9pTBCutvNqsZ2fWm2bbNoiLHc8YEwI9HjznjEQPgXGq38Sl3ofXWjmbI+B2Aigf8jFPn03EvEbmN3Q6w4ZcaqSJABqfsVjJZTQ42CnTeOh+tFkHXN0b3Ow93l902C+JFwhGAAa4vLc4/zqW2ub8acbOxjeSpbsUyoV2cPitPIxLcGTWL6EwjSlXyayxPrGpQ0obmi/9iMG5ApQL4PYynwqeMepIaRma0s6uVJHtQsCDUgQLL0qiAAKWGB6ntnE28nEhKzkFdGUcyOrHsyFInaGhMkN2wxzxPPgK+PFO4XZa4b2G0jNsirjtV6w+4lFFPHUOO7owXOnvLhXaORYlI2f7rbX49H3Bh8+qqGqu9yN+ti3W1RDEcyYB/er5aqEATTpWhj6Vsx9tAY+MZxPgmNdk3ypbZ8jJlRc7NS8yJk8pvqyFprSFazORUTd6/OJl45iTdSKoSJdmkwvcw0L+7dqEw8ulVNdCYsXX7djkrjXYDRaTqU2EYQFkbeDsXxf7r7/lXyZDF2Dn839r/gDfbFmUaJlXTQAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/028f4a1a7c4ef63d480eccf7aba7948b/8ac56/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.webp 240w,\n/static/028f4a1a7c4ef63d480eccf7aba7948b/d3be9/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.webp 480w,\n/static/028f4a1a7c4ef63d480eccf7aba7948b/4d060/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.webp 905w\"\n              sizes=\"(max-width: 905px) 100vw, 905px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/028f4a1a7c4ef63d480eccf7aba7948b/8ff5a/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.png 240w,\n/static/028f4a1a7c4ef63d480eccf7aba7948b/e85cb/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.png 480w,\n/static/028f4a1a7c4ef63d480eccf7aba7948b/65d79/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.png 905w\"\n            sizes=\"(max-width: 905px) 100vw, 905px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/028f4a1a7c4ef63d480eccf7aba7948b/65d79/azure-bastion_prop-001resMode%3Dsharp2%26op_usm%3D1.5%2C0.png\"\n            alt=\"img\"\n            title=\"img\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Reference: <a href=\"https://azure.microsoft.com/en-us/products/azure-bastion\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Azure Bastion - Fully Managed RDP/SSH | Microsoft Azure</a></p>\n<p>Reference: <a href=\"https://learn.microsoft.com/en-us/azure/bastion/bastion-overview\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">About Azure Bastion | Microsoft Learn</a></p>\n<h2 id=\"create-a-virtual-network-and-subnet\" style=\"position:relative;\"><a href=\"#create-a-virtual-network-and-subnet\" aria-label=\"create a virtual network and subnet permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Create a virtual network and subnet</h2>\n<p>To use Bastion, you need a virtual network for deploying Bastion and virtual machines deployed in a subnet within it.</p>\n<p>So first, create a virtual network for a lab environment.</p>\n<p>I created the virtual network with the address space <code class=\"language-text\">172.16.0.0/20</code>, and created one subnet, <code class=\"language-text\">172.16.1.0/24</code>.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 506px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/f528d8ca334a8197819aed45c389370b/29f4e/image-20230504095121475.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 44.583333333333336%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAABCklEQVQoz4VSi46DIBDk///R9IxJpYBFQQV8TXe9alPb8zbZwOIw7OwoyusVWZZBaQWOZVlwjOPZN8wWIqWItusoW0zTBMbyhS23SDGi6/oVc0YqmqbBTSlwp0z8V3f2fkdRFAgxnRM672CqCpUxsLVFCBGh79FTppR2YFPXKEuJmP4hjPFXMhN0JLumi945WGupfnXc057PhnHcCY+j4VVorZHnOX4uF0gpv0o+M+GIEzEENNQRz9J5//H6FiN1NgzDW7JB8zy/4QRLVNQly2GnX/N5EjIxVfytolkbo9dkI6W8rap4ZEzOKdrWE9B8uLr/Ps9iNU8bOFLiac+rre7rzNlURQ845/EADEfAKIu3gEMAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/f528d8ca334a8197819aed45c389370b/8ac56/image-20230504095121475.webp 240w,\n/static/f528d8ca334a8197819aed45c389370b/d3be9/image-20230504095121475.webp 480w,\n/static/f528d8ca334a8197819aed45c389370b/6b97b/image-20230504095121475.webp 506w\"\n              sizes=\"(max-width: 506px) 100vw, 506px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/f528d8ca334a8197819aed45c389370b/8ff5a/image-20230504095121475.png 240w,\n/static/f528d8ca334a8197819aed45c389370b/e85cb/image-20230504095121475.png 480w,\n/static/f528d8ca334a8197819aed45c389370b/29f4e/image-20230504095121475.png 506w\"\n            sizes=\"(max-width: 506px) 100vw, 506px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/f528d8ca334a8197819aed45c389370b/29f4e/image-20230504095121475.png\"\n            alt=\"Create virtual network\"\n            title=\"Create virtual network\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>At this point, assign an NSG with the default configuration that allows inbound communication from the vNet to the <code class=\"language-text\">172.16.1.0/24</code> subnet where you plan to place the virtual machines.</p>\n<h2 id=\"create-virtual-machines\" style=\"position:relative;\"><a href=\"#create-virtual-machines\" aria-label=\"create virtual machines permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Create virtual machines</h2>\n<p>Next, configure the virtual machines that will be accessed remotely through Bastion.</p>\n<p>This time, I configured two machines: RedHat 7.9 and Windows Server 2012 R2.</p>\n<p>Each virtual machine was added to the <code class=\"language-text\">172.16.1.0/24</code> subnet created earlier.</p>\n<p>I also configured NSGs with only the default rules applied.</p>\n<h2 id=\"deploy-bastion-to-the-virtual-network-easy-setup\" style=\"position:relative;\"><a href=\"#deploy-bastion-to-the-virtual-network-easy-setup\" aria-label=\"deploy bastion to the virtual network easy setup permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Deploy Bastion to the virtual network (easy setup)</h2>\n<p>Open the resource page for the virtual network you created earlier, and click [Deploy Bastion] from [Bastion].</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 902px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/698a971601630a90e1495a62b713e489/58213/image-20230504095648733.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 36.66666666666667%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAYAAAAIy204AAAACXBIWXMAAAsTAAALEwEAmpwYAAAA/0lEQVQoz4VQCY7EIAzr//+5M51Syh3O1huoOts9pEWyCDkc40nYCGcNQgjY9x397HvDPM+QUuI4joGcM0opo37l/jqT2TwCBcQYkVIapB2WlxARdh5srfHbDtJ/CbXSY7A397vWOpq1UqxwHap6rhPeye6kZ4yByToH7/0YuopdYYyJldNQ13Pdkp+qTpLvCybPQxt7ZVjBvT3XwBY4lFxYfWKl+Y1UGte738cvTItYIVeBFAkU2E/vUPmblAkvqSA2h2WzEMpjkRbSBBg6YCIQyxeIwXswPYTCxoRaa+QUB3FrFSlXPOcVH88XHs9l3B1KOyjjIJXBup24YqKET/gdImSEn8rKAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/698a971601630a90e1495a62b713e489/8ac56/image-20230504095648733.webp 240w,\n/static/698a971601630a90e1495a62b713e489/d3be9/image-20230504095648733.webp 480w,\n/static/698a971601630a90e1495a62b713e489/5cb76/image-20230504095648733.webp 902w\"\n              sizes=\"(max-width: 902px) 100vw, 902px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/698a971601630a90e1495a62b713e489/8ff5a/image-20230504095648733.png 240w,\n/static/698a971601630a90e1495a62b713e489/e85cb/image-20230504095648733.png 480w,\n/static/698a971601630a90e1495a62b713e489/58213/image-20230504095648733.png 902w\"\n            sizes=\"(max-width: 902px) 100vw, 902px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/698a971601630a90e1495a62b713e489/58213/image-20230504095648733.png\"\n            alt=\"image-20230504095648733\"\n            title=\"image-20230504095648733\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>After waiting about 20 minutes, Bastion is deployed automatically to the virtual network.</p>\n<p>However, Bastion configured this way uses the default settings, and the enabled plan is Basic.</p>\n<p>So if you want to use features that are only available in the Standard plan, such as <a href=\"#remote-access-to-a-virtual-machine-with-a-native-client\">remote access to a virtual machine with a native client</a>, note that you need to <a href=\"#deploy-bastion-to-the-virtual-network-custom\">create Bastion with the custom configuration</a>.</p>\n<p>Once Bastion deployment is complete, confirm that the virtual machines you created earlier appear in the VM list.</p>\n<p>The virtual machine information is based on information shared within the virtual network, so if inbound communication from the vNet is not allowed on the subnet containing the virtual machine or on the NSG attached to the virtual machine, you will not be able to select that virtual machine from Bastion.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 713px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/eff049c024ec45f55cebdac6588f4985/01267/image-20230504142633198.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 41.25%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAl0lEQVQY05WRyw4CIQxF+///596Vm1FK5SGVx3iBxGgyMXgWkAK3ty3EhoGINeaWUsprqCpWSoPHMjFG1f4eevI+QFxrLaXUBWD4HGAnZuuD35eBHrYhdEsSEQR/iXXQe2bGpEzJBzXjKJcvZnettZmI+uhST/P5CNHeysXo6czBWYBPcc7N23cVdBe5bls4ahsGtf1q4QXYqtXyAFlO0wAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/eff049c024ec45f55cebdac6588f4985/8ac56/image-20230504142633198.webp 240w,\n/static/eff049c024ec45f55cebdac6588f4985/d3be9/image-20230504142633198.webp 480w,\n/static/eff049c024ec45f55cebdac6588f4985/69b3e/image-20230504142633198.webp 713w\"\n              sizes=\"(max-width: 713px) 100vw, 713px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/eff049c024ec45f55cebdac6588f4985/8ff5a/image-20230504142633198.png 240w,\n/static/eff049c024ec45f55cebdac6588f4985/e85cb/image-20230504142633198.png 480w,\n/static/eff049c024ec45f55cebdac6588f4985/01267/image-20230504142633198.png 713w\"\n            sizes=\"(max-width: 713px) 100vw, 713px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/eff049c024ec45f55cebdac6588f4985/01267/image-20230504142633198.png\"\n            alt=\"image-20230504142633198\"\n            title=\"image-20230504142633198\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>After selecting the virtual machine, connect to it using a password or private key.</p>\n<p>At this point, besides a password or a certificate in a local file, you can also use a private key managed in Key Vault.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 710px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/e92f2ce03154aec945d82884f2996174/7131f/image-20230504142916198.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 41.25%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAICAIAAAB2/0i6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAz0lEQVQY03WQTVLEIBBGObyX8Aaz9gIuPYAHGMuFTiaBAAlN/wHG0dIEy1dvw1f9dVVjpou1gw022sHlJTMWzrpTjs9vKX3mxtvgXShSqzTlsldIBUWQOfdSIgIyyxJnP+cMotKOsKhfIAICSeeKDMgmpXUDUkLErgxUzu/z63UZPO29enpzOAUyAAlyrrW2P5SiiHlTmEUOMm8niWn/I6rjNDlnVbXe6AZMuYXlmH+NjVGeXzysIW4fE0JaU1++fxzvHi6nJ/fT+V3R+qUdHweR0m6aZTT1AAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/e92f2ce03154aec945d82884f2996174/8ac56/image-20230504142916198.webp 240w,\n/static/e92f2ce03154aec945d82884f2996174/d3be9/image-20230504142916198.webp 480w,\n/static/e92f2ce03154aec945d82884f2996174/457aa/image-20230504142916198.webp 710w\"\n              sizes=\"(max-width: 710px) 100vw, 710px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/e92f2ce03154aec945d82884f2996174/8ff5a/image-20230504142916198.png 240w,\n/static/e92f2ce03154aec945d82884f2996174/e85cb/image-20230504142916198.png 480w,\n/static/e92f2ce03154aec945d82884f2996174/7131f/image-20230504142916198.png 710w\"\n            sizes=\"(max-width: 710px) 100vw, 710px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/e92f2ce03154aec945d82884f2996174/7131f/image-20230504142916198.png\"\n            alt=\"image-20230504142916198\"\n            title=\"image-20230504142916198\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>This opens a new browser window, allowing remote SSH access to the virtual machine in the subnet.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/a506f2b33600189b20c568c3c1f50d37/20751/image-20230504143239855.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 48.33333333333333%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAKCAIAAAA7N+mxAAAACXBIWXMAAAsTAAALEwEAmpwYAAABZUlEQVQoz32Q2W6CQBSGR1GQuiu4XHljXIJWcEsIGK8aU20v2ndo2pdvcQZNUZb2d6g2sUm/TP4cYL45hyHbD7pjO+/zEBxDrD3bU4exrcu2jDmUOpQ5bPtOXeru/0Dw1j/4PjexXl/eVnerzXqzvl8/rB8t0zZGxlifTCbT6WwKUI05hmEQ13U9z4ui8Ivz9PzUarVm8/lshpjruq4NBrej0XA40DSt3+93u91er9fpdNrtNjn6PpyIg8KyLEKIqqj5fL5UKiFvzmSz2VwuJ8syCjyiIHHD2AQYTBAEVVWr1aqiKMhyuRyb2C2m06lUily4kk3TTCaTtVoNJrJSqaBbsVhESpIkcNIcURRJEATRGciLxSKRSMApFAoYGwkTCRm/EB8B7UdmlIZhfFtRPDY+NJtNdG40GvV6/VLjRIkjcjDC79hx5+VyebowVUU3ODIHQiaTOe2+4kq2bRsvcSsJDvmXb9Af4M1iItGwAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/a506f2b33600189b20c568c3c1f50d37/8ac56/image-20230504143239855.webp 240w,\n/static/a506f2b33600189b20c568c3c1f50d37/d3be9/image-20230504143239855.webp 480w,\n/static/a506f2b33600189b20c568c3c1f50d37/e46b2/image-20230504143239855.webp 960w,\n/static/a506f2b33600189b20c568c3c1f50d37/7f429/image-20230504143239855.webp 1037w\"\n              sizes=\"(max-width: 960px) 100vw, 960px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/a506f2b33600189b20c568c3c1f50d37/8ff5a/image-20230504143239855.png 240w,\n/static/a506f2b33600189b20c568c3c1f50d37/e85cb/image-20230504143239855.png 480w,\n/static/a506f2b33600189b20c568c3c1f50d37/d9199/image-20230504143239855.png 960w,\n/static/a506f2b33600189b20c568c3c1f50d37/20751/image-20230504143239855.png 1037w\"\n            sizes=\"(max-width: 960px) 100vw, 960px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/a506f2b33600189b20c568c3c1f50d37/d9199/image-20230504143239855.png\"\n            alt=\"image-20230504143239855\"\n            title=\"image-20230504143239855\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Of course, you can also make an RDP connection to the Windows machine in the browser.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/c1b71642f2c42e80c577ec3bc7058822/cad6c/image-20230504143520601.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 67.91666666666667%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAIAAACgpqunAAAACXBIWXMAAAsTAAALEwEAmpwYAAACiElEQVQoz2NYumyFj49PZGRkWFgYkOFgb+8IBQ5OTo4uLs64gJOTE8Os2XPkFeXVNdXUNNRVVFUUlZWUwaScnJyMtIwsEMjISIOBDBhISUlJAoGUrJSUNMOsmbNa+xdtP3B+9+FTm3cf2nHw+K7Dp/ceO2/j4MjAwMDExMyAB0yfPm35yn2v3/x5/+H75y9/P33+/fHD9x/f//n5BwBlmZlxa2ZkZJgyddrp0ycePbx37dqVp08fP3v25MOXT////w+KjGJgZOARFOTg4eHg4QYhXh5OPj4o4uRkAeqfMWvWkaPHnj55eufO7Xv37t+7/7Bs0Z7EqVt96uda5vaYZ3UZJTcZJTcaJTWapLaaZ3dbZHebZnfbJ9T4h8YxzJw9+8ix4x8+fHrz5vWHj18+fP3pltrBpx4ia5bEqxnOpR7GpxXJpx3JoxnBrRHOrR7GoRrCqhQooBcXVd7JMHf+/IuXLgPd+ffvXyD57///wLx+ZZtUOctkAZ0IeatkVbs0CeM4Ef1oXk2gQeGc6iFsKoFCulHRRU0MEyZMcHJxTU5NjY6Li4mNi01MMg0uVbZOlbNIBGqQNk1QsEoBaTaIEdCJBGlWC2FTBmsubmbo7+8H+pyFhQUShMwsLKKmkUDXcmuEcqoGc6qGcKuHcqmHAPVwAZF6KKdaMLpmdnZ2YKwwMTGxcXCIGEewKASwKQUAFYEQkKEEYYAQu0ogq6K/gHZkdFEzyNlAzWzs7EzMzIxMTKwc7NL2KfwGiQKGCViRoGECn36cpGV6bEUXQ39fH7KzgXHLKSjBKSTNKSSFB3GLyPCLSjJsPXDEJqnQK7smOL/QOb3IM7PEPqPcKr3cGi+ySiu1T8oHAFzh92Ln8OBJAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/c1b71642f2c42e80c577ec3bc7058822/8ac56/image-20230504143520601.webp 240w,\n/static/c1b71642f2c42e80c577ec3bc7058822/d3be9/image-20230504143520601.webp 480w,\n/static/c1b71642f2c42e80c577ec3bc7058822/e46b2/image-20230504143520601.webp 960w,\n/static/c1b71642f2c42e80c577ec3bc7058822/44ab2/image-20230504143520601.webp 1339w\"\n              sizes=\"(max-width: 960px) 100vw, 960px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/c1b71642f2c42e80c577ec3bc7058822/8ff5a/image-20230504143520601.png 240w,\n/static/c1b71642f2c42e80c577ec3bc7058822/e85cb/image-20230504143520601.png 480w,\n/static/c1b71642f2c42e80c577ec3bc7058822/d9199/image-20230504143520601.png 960w,\n/static/c1b71642f2c42e80c577ec3bc7058822/cad6c/image-20230504143520601.png 1339w\"\n            sizes=\"(max-width: 960px) 100vw, 960px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/c1b71642f2c42e80c577ec3bc7058822/d9199/image-20230504143520601.png\"\n            alt=\"image-20230504143520601\"\n            title=\"image-20230504143520601\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<h2 id=\"deploy-bastion-to-the-virtual-network-custom\" style=\"position:relative;\"><a href=\"#deploy-bastion-to-the-virtual-network-custom\" aria-label=\"deploy bastion to the virtual network custom permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Deploy Bastion to the virtual network (custom)</h2>\n<p>To deploy a custom Bastion, open the resource page for the virtual network and click [Configure manually] from [Bastion].</p>\n<p>Since I wanted to use a native client for remote access this time, I selected the Standard tier.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 748px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/383a7b171de04f552aee9ee6b8700d2d/f8915/image-20230505160629936.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 64.58333333333334%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAANCAYAAACpUE5eAAAACXBIWXMAAAsTAAALEwEAmpwYAAABi0lEQVQ4y5WTiXKjMBBE+f/fjCsbx1y6bzo9wjisE1ftqngISdRMz6FhWWZM04R1VZCxbds+tw3RReRYUHP7BypqqRisMWi1PowdBuXw43LFfFuQfKbx9JLkE4KNiD5iMNogp4RjPAzSyTiOUEqhlIKSMym/w/MYI1JMGIIPfSGKzgpbbfj8uEFSYq2FYSSvsNbAOYsYAg3y5ZzjItJY+0ulNwHeO4QYIP91zt93RJDs50yF67qyKHtoEqLW+lEU3Nnq1td97t/4QeO+MHiqE6PO2J63Q11h5S5vE/QaUGND8RUlVGTOyeUfRJP6zJB9T/hzUQpzeJ1WjPPKPGkYu+dLciWOay0n6KzkzpBY4Xpvm2eDf0bVeb8pXMiiDIL3e9VPVJKlCzgP4nVmJed5RmvtsCoPNvz/GLRWNLiwPRb2Y8YukLekbLiuDloxv1QljhVvU6aK8yV4Zogstw/SHr6H892HFTOvpGHVJZwDSdFvSOvIeQ9ZWkZUyuYxJB9SfflZnEg6hFfKDr4AD5j5lz35yv4AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/383a7b171de04f552aee9ee6b8700d2d/8ac56/image-20230505160629936.webp 240w,\n/static/383a7b171de04f552aee9ee6b8700d2d/d3be9/image-20230505160629936.webp 480w,\n/static/383a7b171de04f552aee9ee6b8700d2d/0bb9d/image-20230505160629936.webp 748w\"\n              sizes=\"(max-width: 748px) 100vw, 748px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/383a7b171de04f552aee9ee6b8700d2d/8ff5a/image-20230505160629936.png 240w,\n/static/383a7b171de04f552aee9ee6b8700d2d/e85cb/image-20230505160629936.png 480w,\n/static/383a7b171de04f552aee9ee6b8700d2d/f8915/image-20230505160629936.png 748w\"\n            sizes=\"(max-width: 748px) 100vw, 748px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/383a7b171de04f552aee9ee6b8700d2d/f8915/image-20230505160629936.png\"\n            alt=\"image-20230505160629936\"\n            title=\"image-20230505160629936\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Next, enable [Native client support] under Advanced as well.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 427px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/c8ef33167a03de1676137dfb7bbce62c/a7c74/image-20230505160820277.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 69.16666666666667%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAOCAYAAAAvxDzwAAAACXBIWXMAAAsTAAALEwEAmpwYAAABpElEQVQ4y6VTy07cQBD07/MFfE8OOeQEXHIJCLRm0eLxvJ/esV10zz4EHAKbtNSqkaUpV1fXdMYYOOewLgssnUuZUHKGkhJGa4QQsN/voZVCSgllKjBGE07gWtf1jNydcxbO2vaRcSJC7SNu/vTUz9jsFOZaIYRoP2bSYRgaci1HojNhCB4hhqbEe9/wf6rr+w0e7h+w3T7j8ekJ/aaHGAQkjSzF2MY+jH+whm3RWjV0uWJwZEecIUxEzgndus+YyLOJPJnIq1pnpJiaWu884lF5jLGdGXmKRGhSxdZM2BGpcAWV7nfXvwx+v1gkbzGSIilHKFKQc/m3kX8+euxMQqXtFSIpJTelvLuFNs+9fjL+b91lpxC8a76NI6mjeIxiaGfvAxHOH+LxpUJDPuVSaMR8bvYnp0x+1tbvs/YlYdACRsmWLU0blaRseB1aK0nqQ8Q8f19ld/uSMbqMkmILK2+RfTypZQ8vGvnqx4i73iA5DUs505Q3zp2gjTP5e3XfUrhk8pBeirMO/K5POWPvTnWRh5pILJOxf6SMX8NJGd+/hIzrDac7Q3JwL5lnAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/c8ef33167a03de1676137dfb7bbce62c/8ac56/image-20230505160820277.webp 240w,\n/static/c8ef33167a03de1676137dfb7bbce62c/b957b/image-20230505160820277.webp 427w\"\n              sizes=\"(max-width: 427px) 100vw, 427px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/c8ef33167a03de1676137dfb7bbce62c/8ff5a/image-20230505160820277.png 240w,\n/static/c8ef33167a03de1676137dfb7bbce62c/a7c74/image-20230505160820277.png 427w\"\n            sizes=\"(max-width: 427px) 100vw, 427px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/c8ef33167a03de1676137dfb7bbce62c/a7c74/image-20230505160820277.png\"\n            alt=\"image-20230505160820277\"\n            title=\"image-20230505160820277\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>That completes creation of Bastion with the custom configuration.</p>\n<h2 id=\"remote-access-to-a-virtual-machine-with-a-native-client\" style=\"position:relative;\"><a href=\"#remote-access-to-a-virtual-machine-with-a-native-client\" aria-label=\"remote access to a virtual machine with a native client permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Remote access to a virtual machine with a native client</h2>\n<p>Using Bastion for remote access from a browser is very convenient, but sometimes you may want to connect directly from the host machine using RDP or SSH.</p>\n<p>In that case, use Azure CLI.</p>\n<p>If Azure CLI is not installed yet, install it using the steps below.</p>\n<p>Reference: <a href=\"https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Install the Azure CLI for Windows | Microsoft Learn</a></p>\n<p>Reference: <a href=\"https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Install the Azure CLI on Linux | Microsoft Learn</a></p>\n<p>Using <code class=\"language-text\">winget</code> makes the installation easy.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">winget <span class=\"token function\">install</span> -e --id Microsoft.AzureCLI</code></pre></div>\n<p>Once the installation is complete, run one of the following commands from Command Prompt or similar to authenticate Azure CLI.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">az login\naz login --use-device-code</code></pre></div>\n<p>After Azure CLI authentication is complete, you can use the following command to connect to the Windows machine through Bastion with the native RDP client.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">az network bastion rdp --name <span class=\"token string\">\"&lt;BastionName>\"</span> --resource-group <span class=\"token string\">\"&lt;BastionResourceGroupName>\"</span> --target-resource-id <span class=\"token string\">\"&lt;VMResourceId>\"</span></code></pre></div>\n<p>Reference: <a href=\"https://learn.microsoft.com/en-us/azure/bastion/vm-upload-download-native\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Upload or download files using native client connections - Azure Bastion | Microsoft Learn</a></p>\n<p>Here, if you know the resource group and the virtual machine name, you can also obtain the VM ID to specify in <code class=\"language-text\">--target-resource-id</code> with the following command.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">az vm list --show-details --resource-group EPLab --query <span class=\"token string\">\"[?name == 'Win2012R2'].id\"</span></code></pre></div>\n<p>When I ran the command using the virtual machine ID obtained here, the RDP client launched automatically and I was able to connect to the virtual machine over RDP through Bastion.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">az network bastion rdp --name <span class=\"token string\">\"EPBastion\"</span> --resource-group <span class=\"token string\">\"EPLab\"</span> --target-resource-id <span class=\"token string\">\"&lt;VMResourceId>\"</span></code></pre></div>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/9849b7f4a88415bdb0e26df4eb003893/dcccd/image-20230505162937635.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 43.75%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAACEklEQVQoz5WRy2sTURyFx6BIsfVZH1UbjUmqafFRI0WtoEZBd6ZVa1BjbMVaWpWKKO5bsGAT0kSXihvBrf4FrlwF1EWaSSeE4JhMZjJJqiI07eLzTloRBRcuPu7cy51zzzk/qavnEd5zD2k/e4+203dxnBzB6buN69QdtnbfYsuRQVqODrL58E2a9l9jTWcIW1uA4P0IPt8J7K123G43LpcTj8eDtKrjKmsPhGhov4zkOI/U6v+NvRdppzjb7me1EBsZf8HoxEuGx57z9NVbnsTjjE2GGQ9HeRyNEwiGxH/dQ9iPDdHsHWDF7gDrD/bTfGiAjYJ1nddp6LiCzX0Jr/8Br98keff+M3ltlmS6QCpjkFVnxWqSN2qEY8+Q9oiYG7z9NO4N0rgviOP4MNtEzPpesNIjnO/orVcgKyrpmRwzSo6CVsIwKhSLJppm8P3bDyajUyKVcNci+rFiWwKW001dN+qrFbNJnNlcfXjOjKKXDD59/EAikSCVmkaWU2SzWVRVpTY3RyQWR1omLltRrVjW9y+svcVyMQCrR7dwqBV1ppNJISajKBnSskxGURYFazUiU0KwXrrz4j+xuftE0T3sEtPX9BLZnEo+n8comRRKX8kLDLPCwsL8kqDjwh/O/sZyKdkXBS0RraChF4tUKhXMcnWJMvN1h7H/E1Q1nXK1im6WlzCFu7KYepEv4qGJcISfivujarhf7x8AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/9849b7f4a88415bdb0e26df4eb003893/8ac56/image-20230505162937635.webp 240w,\n/static/9849b7f4a88415bdb0e26df4eb003893/d3be9/image-20230505162937635.webp 480w,\n/static/9849b7f4a88415bdb0e26df4eb003893/e46b2/image-20230505162937635.webp 960w,\n/static/9849b7f4a88415bdb0e26df4eb003893/0b154/image-20230505162937635.webp 1127w\"\n              sizes=\"(max-width: 960px) 100vw, 960px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/9849b7f4a88415bdb0e26df4eb003893/8ff5a/image-20230505162937635.png 240w,\n/static/9849b7f4a88415bdb0e26df4eb003893/e85cb/image-20230505162937635.png 480w,\n/static/9849b7f4a88415bdb0e26df4eb003893/d9199/image-20230505162937635.png 960w,\n/static/9849b7f4a88415bdb0e26df4eb003893/dcccd/image-20230505162937635.png 1127w\"\n            sizes=\"(max-width: 960px) 100vw, 960px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/9849b7f4a88415bdb0e26df4eb003893/d9199/image-20230505162937635.png\"\n            alt=\"image-20230505162937635\"\n            title=\"image-20230505162937635\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<p>Next, connect to the Linux machine over SSH from the host machine.</p>\n<p>You can do this by configuring tunneling with the following command.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">az network bastion tunnel --name <span class=\"token string\">\"&lt;BastionName>\"</span> --resource-group <span class=\"token string\">\"&lt;ResourceGroupName>\"</span> --target-resource-id <span class=\"token string\">\"&lt;VMResourceId>\"</span> --resource-port <span class=\"token string\">\"&lt;TargetVMPort>\"</span> --port <span class=\"token string\">\"&lt;LocalMachinePort>\"</span></code></pre></div>\n<p>This time, I used a command like the following.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\">az network bastion tunnel --name <span class=\"token string\">\"EPBastion\"</span> --resource-group <span class=\"token string\">\"EPLab\"</span> --resource-port <span class=\"token number\">22</span> --port <span class=\"token number\">2222</span> --target-resource-id <span class=\"token string\">\"&lt;VMResourceId>\"</span> </code></pre></div>\n<p>This command forwards local host port 2222 to port 22 on the virtual machine through Bastion, so you can then connect over SSH with the following command.</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">ssh</span> -p <span class=\"token number\">2222</span> azureuser@127.0.0.1</code></pre></div>\n<p>That let me connect from localhost to the Azure VM over SSH.</p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 960px; \"\n    >\n      <a\n    class=\"gatsby-resp-image-link\"\n    href=\"/static/1d6988a75efaff63fe40e31454cf4fb9/91b29/image-20230505163838605.png\"\n    style=\"display: block\"\n    target=\"_blank\"\n    rel=\"noopener\"\n  >\n    <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 31.666666666666664%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA00lEQVQY022QxwrEMAxEc0wnkN5I74X8/8/NMgItWdjDQ7Jsj0Yy1nXFvu84jgPMSVEUKMvyJ+Z5jrqu5UyqqpI6Y5qmkodhCIOF67rwPA+2bZM4TROGYRD6vpcz32VZJiRJIsRxLLiu+8XwPA9d12FZFnFHUebqLooimKYJx3Fg2/YPWmNUDHakAF1y7PM8Mc+zuCJs1jSNjMWx1aU6Zc33fRETh0EQQPdI7vsWKMwmvKNTFaOwCryhmDjkDuiEYvzMnY3jiLZtxR2FLMv6K/BGax8anZwBXZVjnAAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <picture>\n          <source\n              srcset=\"/static/1d6988a75efaff63fe40e31454cf4fb9/8ac56/image-20230505163838605.webp 240w,\n/static/1d6988a75efaff63fe40e31454cf4fb9/d3be9/image-20230505163838605.webp 480w,\n/static/1d6988a75efaff63fe40e31454cf4fb9/e46b2/image-20230505163838605.webp 960w,\n/static/1d6988a75efaff63fe40e31454cf4fb9/b4d37/image-20230505163838605.webp 983w\"\n              sizes=\"(max-width: 960px) 100vw, 960px\"\n              type=\"image/webp\"\n            />\n          <source\n            srcset=\"/static/1d6988a75efaff63fe40e31454cf4fb9/8ff5a/image-20230505163838605.png 240w,\n/static/1d6988a75efaff63fe40e31454cf4fb9/e85cb/image-20230505163838605.png 480w,\n/static/1d6988a75efaff63fe40e31454cf4fb9/d9199/image-20230505163838605.png 960w,\n/static/1d6988a75efaff63fe40e31454cf4fb9/91b29/image-20230505163838605.png 983w\"\n            sizes=\"(max-width: 960px) 100vw, 960px\"\n            type=\"image/png\"\n          />\n          <img\n            class=\"gatsby-resp-image-image\"\n            src=\"/static/1d6988a75efaff63fe40e31454cf4fb9/d9199/image-20230505163838605.png\"\n            alt=\"image-20230505163838605\"\n            title=\"image-20230505163838605\"\n            loading=\"lazy\"\n            style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n          />\n        </picture>\n  </a>\n    </span></p>\n<h2 id=\"summary\" style=\"position:relative;\"><a href=\"#summary\" aria-label=\"summary permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Summary</h2>\n<p>Now that I have built an Azure Bastion environment, it feels like my lab environment has leveled up once again.</p>\n<p>Being able to operate VMs from the Azure portal also seems very useful for cases where you want to keep them completely separated from your local machine at the network level.</p>\n<h2 id=\"update-may-6-2023\" style=\"position:relative;\"><a href=\"#update-may-6-2023\" aria-label=\"update may 6 2023 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Update (May 6, 2023)</h2>\n<p>The Azure Bastion environment I built this way was very comfortable to use, but it cost about 1,000 yen per day, which made it difficult to run personally, so I ended up deleting it.</p>\n<p>Unfortunately.</p>","fields":{"slug":"/azure-bastion-tutorial-en","tagSlugs":["/tag/azure-en/","/tag/security-en/","/tag/備忘録/","/tag/az-500-en/","/tag/english/"]},"frontmatter":{"date":"2023-05-05","description":"Build an environment where you can securely access Azure VMs remotely with Azure Bastion.","tags":["Azure (en)","Security (en)","備忘録","AZ-500 (en)","English"],"title":"Use Azure Bastion to build an environment for secure remote access to Azure VMs","socialImage":{"publicURL":"/static/b8469c310f081fd58309a6836fce9b5c/azure-bastion-tutorial.png"}}}},"pageContext":{"slug":"/azure-bastion-tutorial-en"}},"staticQueryHashes":["251939775","401334301","825871152"]}