Microsoft Azure Learning Journey

Build a Private Azure Network and Prove the DNS Works

Create segmented subnets, connect a storage account through a private endpoint, and test DNS from inside and outside the VNet.

9 min read · 1715 words
Microsoft AzureAzure NetworkingCloud NetworkingNetwork SecurityDevOps
Build a Private Azure Network and Prove the DNS Works cover image

A private endpoint can look correct in the portal and still fail from the application. This lab makes the network path observable: an isolated VNet, an endpoint subnet, a storage account with public access disabled, and a linked private DNS zone. You will test name resolution from a host inside the VNet and compare it with a client outside.

This lab creates Azure resources and may incur charges. Use an approved development subscription, keep the deployment short, and follow cleanup in order. The commands have not been executed against a live subscription.

What you’ll build

Prerequisites

Architecture and boundaries

Outside client                         VNet: 10.42.0.0/16
  service public DNS                         |
  public network access disabled              +-- client subnet 10.42.1.0/24
                                               |      test host resolves private IP
                                               |
                                               +-- private-endpoint subnet 10.42.2.0/24
                                                      |
                                                      +--> Storage Blob private endpoint
                                                            |
                                                            +--> Storage account

Private DNS zone privatelink.blob.core.windows.net
       linked to VNet; normal blob hostname resolves to endpoint IP inside the VNet

DNS and authorization are independent. This lab validates the private network/DNS path; it does not grant a principal blob data access. A DNS response from the public namespace is not proof of public access.

Step 1: Select and validate the subscription

az login
az account list --query "[?state=='Enabled'].{name:name, isDefault:isDefault}" --output table
az account set --subscription "<YOUR_DEVELOPMENT_SUBSCRIPTION_ID_OR_NAME>"
az account show --query "{name:name, id:id, tenantId:tenantId}" --output table

Stop if the selected subscription is not the approved development environment.

Step 2: Define names and create the network

TRUSTED_SSH_CIDR="<YOUR_PUBLIC_IPV4>/32"
SUFFIX="$(uuidgen | tr -d '-' | tr '[:upper:]' '[:lower:]' | cut -c1-8)"
LOCATION="eastus"
RESOURCE_GROUP="rg-private-net-${SUFFIX}"
VNET_NAME="vnet-private-${SUFFIX}"
CLIENT_SUBNET="snet-client"
PE_SUBNET="snet-private-endpoints"
STORAGE_ACCOUNT="stpriv${SUFFIX}"
PRIVATE_DNS_ZONE="privatelink.blob.core.windows.net"
VM_NAME="vm-dns-test-${SUFFIX}"
NSG_NAME="nsg-dns-test-${SUFFIX}"
: "${TRUSTED_SSH_CIDR:?Set TRUSTED_SSH_CIDR to your public IPv4 address with /32}"

az group create --name "$RESOURCE_GROUP" --location "$LOCATION" \
  --tags purpose=learning lab=private-network --output none

az network vnet create --resource-group "$RESOURCE_GROUP" \
  --name "$VNET_NAME" --location "$LOCATION" \
  --address-prefixes 10.42.0.0/16 \
  --subnet-name "$CLIENT_SUBNET" --subnet-prefixes 10.42.1.0/24 \
  --output none

az network vnet subnet create --resource-group "$RESOURCE_GROUP" \
  --vnet-name "$VNET_NAME" --name "$PE_SUBNET" \
  --address-prefixes 10.42.2.0/24 \
  --private-endpoint-network-policies Disabled --output none

az network nsg create --resource-group "$RESOURCE_GROUP" \
  --name "$NSG_NAME" --location "$LOCATION" --output none
az network nsg rule create --resource-group "$RESOURCE_GROUP" \
  --nsg-name "$NSG_NAME" --name "allow-ssh-from-my-ip" \
  --priority 100 --direction Inbound --access Allow --protocol Tcp \
  --source-address-prefixes "$TRUSTED_SSH_CIDR" \
  --destination-port-ranges 22 --output none
az network vnet subnet update --resource-group "$RESOURCE_GROUP" \
  --vnet-name "$VNET_NAME" --name "$CLIENT_SUBNET" \
  --network-security-group "$NSG_NAME" --output none

az vm create --resource-group "$RESOURCE_GROUP" --name "$VM_NAME" \
  --location "$LOCATION" --image Ubuntu2204 --size Standard_B1s \
  --vnet-name "$VNET_NAME" --subnet "$CLIENT_SUBNET" \
  --public-ip-address "pip-${VM_NAME}" --public-ip-sku Standard \
  --admin-username azureuser --generate-ssh-keys --nsg-rule NONE \
  --output none
VM_PUBLIC_IP="$(az vm list-ip-addresses --resource-group "$RESOURCE_GROUP" \
  --name "$VM_NAME" \
  --query "[0].virtualMachine.network.publicIpAddresses[0].ipAddress" \
  --output tsv)"

Replace <YOUR_PUBLIC_IPV4> with your current public IPv4 address before running this step. Do not use 0.0.0.0/0. Verify the CIDR ranges do not overlap with any network that will connect to this lab. Private endpoint network policy syntax and service requirements can change; consult current CLI help and documentation if the command rejects the option.

✅ Checkpoint: az network vnet show reports 10.42.0.0/16 and two distinct subnets; the VM’s SSH rule contains only your trusted CIDR.

Step 3: Create a storage account and private endpoint

The name must be globally unique, lowercase, and within Azure Storage naming constraints. If the generated name is unavailable, choose another unique suffix.

az storage account create --resource-group "$RESOURCE_GROUP" \
  --name "$STORAGE_ACCOUNT" --location "$LOCATION" \
  --sku Standard_LRS --kind StorageV2 \
  --allow-blob-public-access false \
  --public-network-access Disabled \
  --min-tls-version TLS1_2 \
  --output none

STORAGE_ID="$(az storage account show --resource-group "$RESOURCE_GROUP" \
  --name "$STORAGE_ACCOUNT" --query id --output tsv)"

az network private-endpoint create --resource-group "$RESOURCE_GROUP" \
  --name "pe-blob-${SUFFIX}" --location "$LOCATION" \
  --vnet-name "$VNET_NAME" --subnet "$PE_SUBNET" \
  --private-connection-resource-id "$STORAGE_ID" \
  --group-id blob --connection-name "conn-blob-${SUFFIX}" \
  --output none

Check the endpoint connection state before testing. If it is pending, an authorized owner of the target resource must approve it.

✅ Checkpoint: The private endpoint is approved and its NIC has an address from 10.42.2.0/24.

Step 4: Add private DNS and link the VNet

az network private-dns zone create --resource-group "$RESOURCE_GROUP" \
  --name "$PRIVATE_DNS_ZONE" --output none

PRIVATE_DNS_ZONE_ID="$(az network private-dns zone show \
  --resource-group "$RESOURCE_GROUP" --name "$PRIVATE_DNS_ZONE" \
  --query id --output tsv)"

az network private-dns link vnet create --resource-group "$RESOURCE_GROUP" \
  --zone-name "$PRIVATE_DNS_ZONE" --name "link-${SUFFIX}" \
  --virtual-network "$VNET_NAME" --registration-enabled false \
  --output none

az network private-endpoint dns-zone-group create \
  --resource-group "$RESOURCE_GROUP" \
  --endpoint-name "pe-blob-${SUFFIX}" \
  --name "zone-group" \
  --private-dns-zone "$PRIVATE_DNS_ZONE_ID" \
  --zone-name "blob" --output none

The DNS zone group links the endpoint to the private zone and maintains the endpoint record. Query the normal storage account hostname; do not hard-code the private IP.

Step 5: Prove name resolution from both locations

From your computer, connect to the test VM. The NSG permits SSH only from the CIDR you supplied:

ssh "azureuser@${VM_PUBLIC_IP}" \
  "nslookup '${STORAGE_ACCOUNT}.blob.core.windows.net'"

The answer chain from the VM should lead to a private IP assigned to the endpoint. Compare it with the endpoint NIC:

az network private-endpoint show --resource-group "$RESOURCE_GROUP" \
  --name "pe-blob-${SUFFIX}" \
  --query "customDnsConfigs[].{fqdn: fqdn, ips: ipAddresses}" --output table

From your computer (outside the VNet), query the same hostname with nslookup "${STORAGE_ACCOUNT}.blob.core.windows.net" and inspect the answer. Then attempt service access only with an identity and data-plane permissions you are authorized to use. With public network access disabled, the public route should not provide service access. DNS answers alone do not prove access or denial.

✅ Checkpoint: Inside the VNet, the storage FQDN resolves to the private endpoint IP. The outside client does not resolve to that private endpoint address, and the storage public network path is disabled. A network timeout/denial is not a substitute for verifying the account’s network setting.

Permissions and security notes

Cost and production options

The storage account and private endpoint can incur charges even when idle. A test VM, Bastion, NAT Gateway, firewall, and data transfer add costs. Confirm current pricing and delete the lab when finished. This lab does not include an NSG, VM, Bastion, or NAT Gateway; add them only in a separately cost-reviewed exercise.

Production needs resilient DNS forwarding, documented address allocation, monitoring, service authorization, availability planning, and validation from all intended client networks. Do not create a second endpoint to the same service in the same private DNS zone without checking current guidance; conflicting records can break resolution.

Troubleshooting

Five-pillar readiness checklist

Cleanup

The lab’s network, VM, public IP, NSG, endpoint, DNS zone, and storage account are all in the temporary resource group. Verify the group name before deletion:

printf 'Resource group to remove: %s\n' "$RESOURCE_GROUP"
az group show --name "$RESOURCE_GROUP" --query "{name:name, location:location}" --output table

After confirming it is lab-owned and contains no needed resources, delete it:

az group delete --name "$RESOURCE_GROUP" --yes --no-wait

Check completion later with az group exists --name "$RESOURCE_GROUP". Do not delete a shared group. This lab created no tenant-level identity objects or role assignments.

Key takeaways

Next: Azure Virtual Machines: More Than a Server in the Cloud.

Series navigation: Previous: DNS and Load Balancing · Current: Phase 3, Part 5 · Next: Azure Virtual Machines (planned)

References

Share this article

LinkedIn post draft