Skip to content

Latest commit

 

History

History
143 lines (94 loc) · 8.08 KB

create-private-endpoint-template.md

File metadata and controls

143 lines (94 loc) · 8.08 KB
title description services author ms.service ms.topic ms.date ms.author ms.custom
Quickstart: Create a private endpoint - ARM template
In this quickstart, you'll learn how to create a private endpoint using an Azure Resource Manager template (ARM template).
private-link
abell
private-link
quickstart
03/28/2024
abell
subject-armqs, mode-arm, template-quickstart, devx-track-arm-template

Quickstart: Create a private endpoint by using an ARM template

In this quickstart, you'll use an Azure Resource Manager template (ARM template) to create a private endpoint.

[!INCLUDE About Azure Resource Manager]

You can also create a private endpoint by using the Azure portal, Azure PowerShell, or the Azure CLI.

If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button here. The ARM template will open in the Azure portal.

:::image type="content" source="~/reusable-content/ce-skilling/azure/media/template-deployments/deploy-to-azure-button.svg" alt-text="Button to deploy the Resource Manager template to Azure." border="false" link="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.sql%2Fprivate-endpoint-sql%2Fazuredeploy.json":::

:::image type="content" source="./media/create-private-endpoint-portal/private-endpoint-qs-resources-sql.png" alt-text="Diagram of resources created in private endpoint quickstart." lightbox="./media/create-private-endpoint-portal/private-endpoint-qs-resources-sql.png":::

Prerequisites

You need an Azure account with an active subscription. If you don't already have an Azure account, create an account for free.

Review the template

This template creates a private endpoint for an instance of Azure SQL Database.

The template that this quickstart uses is from Azure Quickstart Templates.

:::code language="json" source="~/quickstart-templates/quickstarts/microsoft.sql/private-endpoint-sql/azuredeploy.json":::

The template defines multiple Azure resources:

Deploy the template

Deploy the ARM template to Azure by doing the following:

  1. Sign in to Azure and open the ARM template by selecting the Deploy to Azure button here. The template creates the private endpoint, the instance of SQL Database, the network infrastructure, and a virtual machine to be validated.

    :::image type="content" source="~/reusable-content/ce-skilling/azure/media/template-deployments/deploy-to-azure-button.svg" alt-text="Button to deploy the Resource Manager template to Azure." border="false" link="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.sql%2Fprivate-endpoint-sql%2Fazuredeploy.json":::

  2. Select your resource group or create a new one.

  3. Enter the SQL administrator sign-in name and password.

  4. Enter the virtual machine administrator username and password.

  5. Read the terms and conditions statement. If you agree, select I agree to the terms and conditions stated above, and then select Purchase. The deployment can take 20 minutes or longer to complete.

Validate the deployment

Note

The ARM template generates a unique name for the virtual machine myVm{uniqueid} resource, and for the SQL Database sqlserver{uniqueid} resource. Substitute your generated value for {uniqueid}.

Connect to a VM from the internet

Connect to the VM myVm{uniqueid} from the internet by doing the following:

  1. In the portal's search bar, enter myVm{uniqueid}.

  2. Select Connect. Connect to virtual machine opens.

  3. Select Download RDP File. Azure creates a Remote Desktop Protocol (RDP) file and downloads it to your computer.

  4. Open the downloaded RDP file.

    a. If you're prompted, select Connect.
    b. Enter the username and password that you specified when you created the VM.

    [!NOTE] You might need to select More choices > Use a different account to specify the credentials you entered when you created the VM.

  5. Select OK.

    You might receive a certificate warning during the sign-in process. If you do, select Yes or Continue.

  6. After the VM desktop appears, minimize it to go back to your local desktop.

Access the SQL Database server privately from the VM

To connect to the SQL Database server from the VM by using the private endpoint, do the following:

  1. On the Remote Desktop of myVM{uniqueid}, open PowerShell.

  2. Run the following command:

    nslookup sqlserver{uniqueid}.database.windows.net

    You'll receive a message that's similar to this one:

      Server:  UnKnown
      Address:  168.63.129.16
      Non-authoritative answer:
      Name:    sqlserver.privatelink.database.windows.net
      Address:  10.0.0.5
      Aliases:  sqlserver.database.windows.net
    
  3. Install SQL Server Management Studio.

  4. On the Connect to server pane, do the following:

    • For Server type, select Database Engine.
    • For Server name, select sqlserver{uniqueid}.database.windows.net.
    • For Username, enter the username that was provided earlier.
    • For Password, enter the password that was provided earlier.
    • For Remember password, select Yes.
  5. Select Connect.

  6. On the left pane, select Databases. Optionally, you can create or query information from sample-db.

  7. Close the Remote Desktop connection to myVm{uniqueid}.

Clean up resources

When you no longer need the resources that you created with the private endpoint, delete the resource group. Doing so removes the private endpoint and all the related resources.

To delete the resource group, run the Remove-AzResourceGroup cmdlet:

Remove-AzResourceGroup -Name <your resource group name>

Next steps

For more information about the services that support private endpoints, see:

[!div class="nextstepaction"] What is Azure Private Link?