Bird
Raised Fist0
Azurecloud~5 mins

Private endpoints concept in Azure - Commands & Configuration

Choose your learning style10 modes available
Introduction
Sometimes you want to connect to a cloud service without using the public internet. Private endpoints let you do this by creating a private connection inside your network. This keeps your data safer and faster.
When you want to connect your app to a database without exposing it to the internet.
When you need to access storage accounts securely from your virtual network.
When you want to limit access to cloud services only from your private network.
When you want to avoid data transfer over the public internet for compliance reasons.
When you want to reduce exposure to internet-based attacks on your cloud resources.
Config File - private-endpoint.json
private-endpoint.json
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "privateEndpointName": {
      "type": "string",
      "defaultValue": "myPrivateEndpoint"
    },
    "vnetName": {
      "type": "string",
      "defaultValue": "myVnet"
    },
    "subnetName": {
      "type": "string",
      "defaultValue": "mySubnet"
    },
    "resourceGroupName": {
      "type": "string",
      "defaultValue": "example-resource-group"
    },
    "privateLinkServiceId": {
      "type": "string",
      "defaultValue": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageaccount"
    },
    "groupIds": {
      "type": "array",
      "defaultValue": ["blob"]
    }
  },
  "resources": [
    {
      "type": "Microsoft.Network/privateEndpoints",
      "apiVersion": "2021-05-01",
      "name": "[parameters('privateEndpointName')]",
      "location": "eastus",
      "properties": {
        "subnet": {
          "id": "[resourceId(parameters('resourceGroupName'), 'Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
        },
        "privateLinkServiceConnections": [
          {
            "name": "myConnection",
            "properties": {
              "privateLinkServiceId": "[parameters('privateLinkServiceId')]",
              "groupIds": ["blob"],
              "requestMessage": "Please approve my connection"
            }
          }
        ]
      }
    }
  ]
}

This JSON is an Azure Resource Manager template that creates a private endpoint.

privateEndpointName: The name of the private endpoint resource.

vnetName and subnetName: Specify where the private endpoint will be placed inside your virtual network.

privateLinkServiceId: The resource ID of the service you want to connect privately, like a storage account.

groupIds: The specific service group to connect to, such as 'blob' for storage blobs.

The template creates a private endpoint that connects your virtual network subnet to the specified service privately.

Commands
This command creates a private endpoint named 'myPrivateEndpoint' in the 'example-resource-group'. It connects the subnet 'mySubnet' inside the virtual network 'myVnet' to the storage account privately. The group id 'blob' specifies the service type.
Terminal
az network private-endpoint create --name myPrivateEndpoint --resource-group example-resource-group --vnet-name myVnet --subnet mySubnet --private-connection-resource-id /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageaccount --group-ids blob --location eastus
Expected OutputExpected
{ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint", "location": "eastus", "name": "myPrivateEndpoint", "properties": { "customDnsConfigs": [], "ipConfigurations": [ { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint/ipConfigurations/ipconfig1", "properties": { "privateIpAddress": "10.0.1.5", "privateIpAllocationMethod": "Dynamic", "subnet": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet" } }, "name": "ipconfig1" } ], "privateLinkServiceConnections": [ { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint/privateLinkServiceConnections/myConnection", "properties": { "privateLinkServiceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageaccount", "groupIds": [ "blob" ], "requestMessage": "Please approve my connection", "status": "Pending" }, "name": "myConnection" } ], "provisioningState": "Succeeded" }, "type": "Microsoft.Network/privateEndpoints" }
→
--name - Sets the name of the private endpoint.
→
--resource-group - Specifies the resource group where the endpoint is created.
→
--private-connection-resource-id - The resource ID of the service to connect privately.
This command lists all private endpoints in the 'example-resource-group' to verify the creation.
Terminal
az network private-endpoint list --resource-group example-resource-group
Expected OutputExpected
[ { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint", "location": "eastus", "name": "myPrivateEndpoint", "properties": { "provisioningState": "Succeeded" }, "type": "Microsoft.Network/privateEndpoints" } ]
→
--resource-group - Filters the list to the specified resource group.
This command approves the private endpoint connection request from the storage account side, allowing the private link to be active.
Terminal
az network private-endpoint-connection approve --resource-group example-resource-group --name mystorageaccount --private-endpoint-connection-name myConnection --description "Approving private endpoint connection"
Expected OutputExpected
{ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageaccount/privateEndpointConnections/myConnection", "name": "myConnection", "properties": { "privateEndpoint": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" }, "privateLinkServiceConnectionState": { "actionsRequired": "None", "description": "Approved by user", "status": "Approved" }, "provisioningState": "Succeeded" }, "type": "Microsoft.Storage/storageAccounts/privateEndpointConnections" }
→
--resource-group - Specifies the resource group of the storage account.
→
--name - The name of the storage account.
→
--private-endpoint-connection-name - The name of the private endpoint connection to approve.
This command shows detailed information about the private endpoint to confirm its status and IP address.
Terminal
az network private-endpoint show --resource-group example-resource-group --name myPrivateEndpoint
Expected OutputExpected
{ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint", "location": "eastus", "name": "myPrivateEndpoint", "properties": { "ipConfigurations": [ { "properties": { "privateIpAddress": "10.0.1.5", "privateIpAllocationMethod": "Dynamic" }, "name": "ipconfig1" } ], "provisioningState": "Succeeded", "privateLinkServiceConnections": [ { "properties": { "privateLinkServiceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resource-group/providers/Microsoft.Storage/storageAccounts/mystorageaccount", "privateLinkServiceConnectionState": { "status": "Approved", "description": "Approved by user", "actionsRequired": "None" } }, "name": "myConnection" } ] }, "type": "Microsoft.Network/privateEndpoints" }
→
--resource-group - Specifies the resource group of the private endpoint.
→
--name - The name of the private endpoint to show.
Key Concept

If you remember nothing else from this pattern, remember: private endpoints let you connect cloud services securely inside your network without using the public internet.

Common Mistakes
Not approving the private endpoint connection from the service side after creating it.
The private endpoint remains in a pending state and cannot be used until approved.
Run the approval command to accept the connection request from the service.
Creating the private endpoint in a subnet that has a network security group blocking required traffic.
The private endpoint cannot communicate properly, causing connection failures.
Ensure the subnet allows necessary traffic for private endpoint communication.
Using incorrect resource IDs or group IDs when creating the private endpoint.
The private endpoint will not connect to the intended service, causing errors.
Double-check and use the exact resource ID and correct group IDs for the target service.
Summary
Create a private endpoint to connect your virtual network subnet privately to a cloud service.
Approve the private endpoint connection from the service side to activate it.
Verify the private endpoint status and IP address to confirm successful setup.

Practice

(1/5)
1. What is the main purpose of an Azure Private Endpoint?
easy
A. To make Azure services publicly accessible over the internet
B. To increase the speed of internet browsing
C. To connect to Azure services privately within your network
D. To create virtual machines automatically

Solution

  1. Step 1: Understand what a Private Endpoint does

    A Private Endpoint connects your network privately to Azure services, avoiding public internet.
  2. Step 2: Compare options with this definition

    Only To connect to Azure services privately within your network describes private network connection to Azure services.
  3. Final Answer:

    To connect to Azure services privately within your network -> Option C
  4. Quick Check:

    Private Endpoint = Private connection [OK]
Hint: Private endpoints = private network access to Azure [OK]
Common Mistakes:
  • Confusing private endpoint with public access
  • Thinking it speeds up internet browsing
  • Assuming it creates virtual machines
2. Which of the following is the correct way to create a Private Endpoint in Azure Portal?
easy
A. Go to Private Link Center > Private Endpoints > Create
B. Go to Virtual Machines > Create > Private Endpoint
C. Go to Storage Accounts > Networking > Public Access
D. Go to Azure Active Directory > Users > Private Endpoint

Solution

  1. Step 1: Identify where Private Endpoints are managed

    Private Endpoints are created under Private Link Center in Azure Portal.
  2. Step 2: Match the correct navigation path

    Go to Private Link Center > Private Endpoints > Create correctly shows Private Link Center > Private Endpoints > Create.
  3. Final Answer:

    Go to Private Link Center > Private Endpoints > Create -> Option A
  4. Quick Check:

    Private Endpoint creation is in Private Link Center [OK]
Hint: Private Endpoints are under Private Link Center in Azure Portal [OK]
Common Mistakes:
  • Looking under Virtual Machines or Storage Accounts
  • Confusing Private Endpoint with user management
  • Selecting Public Access settings instead
3. Consider this scenario: You create a Private Endpoint for an Azure Storage Account. What happens to the network traffic when you access the storage account from your virtual network?
medium
A. Traffic goes over the public internet but is encrypted
B. Traffic is routed through a public IP address of the storage account
C. Traffic is blocked unless you use a VPN
D. Traffic is routed privately inside Azure network, avoiding public internet

Solution

  1. Step 1: Understand Private Endpoint traffic routing

    Private Endpoints route traffic privately inside Azure, avoiding the public internet.
  2. Step 2: Analyze each option

    Traffic is routed privately inside Azure network, avoiding public internet correctly states traffic is routed privately inside Azure network.
  3. Final Answer:

    Traffic is routed privately inside Azure network, avoiding public internet -> Option D
  4. Quick Check:

    Private Endpoint = private routing inside Azure [OK]
Hint: Private Endpoint routes traffic inside Azure, not public internet [OK]
Common Mistakes:
  • Assuming traffic still uses public internet
  • Thinking VPN is always required
  • Confusing public IP routing with private endpoint
4. You created a Private Endpoint but your virtual machine cannot access the Azure SQL Database privately. What is the most likely cause?
medium
A. The virtual machine is not in the same subscription
B. The Private Endpoint DNS configuration is missing or incorrect
C. Azure SQL Database does not support Private Endpoints
D. The virtual machine needs a public IP address

Solution

  1. Step 1: Identify common Private Endpoint issues

    DNS configuration is critical for Private Endpoint to resolve the private IP address.
  2. Step 2: Evaluate options

    The Private Endpoint DNS configuration is missing or incorrect points to DNS misconfiguration, a common cause of access failure.
  3. Final Answer:

    The Private Endpoint DNS configuration is missing or incorrect -> Option B
  4. Quick Check:

    DNS setup is key for Private Endpoint access [OK]
Hint: Check DNS settings if Private Endpoint access fails [OK]
Common Mistakes:
  • Assuming subscription difference blocks access
  • Believing Azure SQL doesn't support Private Endpoints
  • Thinking public IP is needed for private access
5. You want to secure access to an Azure Key Vault so only your virtual network can reach it privately. Which combination of Azure features should you use?
hard
A. Enable Private Endpoint for the Key Vault and configure DNS to resolve the private IP
B. Use a Public IP with firewall rules allowing your network IP range
C. Create a Private Endpoint for the Key Vault and configure virtual network service endpoints
D. Deploy a VPN gateway and connect to the Key Vault over public internet

Solution

  1. Step 1: Understand securing Key Vault with private access

    Private Endpoint provides private IP access; DNS must resolve Key Vault name to this private IP.
  2. Step 2: Analyze options for best practice

    Enable Private Endpoint for the Key Vault and configure DNS to resolve the private IP correctly combines Private Endpoint creation with DNS configuration for private access.
  3. Final Answer:

    Enable Private Endpoint for the Key Vault and configure DNS to resolve the private IP -> Option A
  4. Quick Check:

    Private Endpoint + DNS config = secure private access [OK]
Hint: Private Endpoint plus DNS setup secures private access [OK]
Common Mistakes:
  • Confusing service endpoints with Private Endpoints
  • Relying on public IP and firewall only
  • Using VPN unnecessarily for private Azure service access
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard