About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_first
⚠️
missing_linux_example
Summary:
The documentation page demonstrates a Windows bias by providing only PowerShell automation examples for DNS setup and referencing PowerShell first when describing how to create a cluster. There are no equivalent Bash or Azure CLI script examples for Linux users, and the PowerShell approach is presented as the primary method for automation.
Recommendations:
- Provide equivalent Bash/Azure CLI script examples for DNS automation tasks, ensuring Linux users can follow along without needing PowerShell.
- When referencing how to create a cluster, mention Azure CLI and ARM templates before or alongside PowerShell, not after.
- Add explicit Linux/macOS guidance or notes where automation or scripting is discussed, clarifying that all steps can be performed cross-platform.
- Where possible, use cross-platform tools (e.g., Azure CLI, ARM templates) in code examples, or provide parallel examples for both Windows (PowerShell) and Linux (Bash/CLI).
Create pull request
Flagged Code Snippets
<#
This script is an example to help you get started with automation and can be adjusted based on your needs.
This script assumes:
- The HDInsight cluster has already been created, and the context where this script is run has permissions to read/write resources in the same resource group.
- The private DNS zone resource exists in the same subscription as the HDInsight cluster.
We recommend that you use the latest version of the Az.HDInsight module.
#>
$subscriptionId = "<Replace with subscription for deploying HDInsight clusters, and containing private DNS zone resource>"
$clusterName = "<Replace with cluster name>"
$clusterResourceGroupName = "<Replace with resource group name>"
# For example, azurehdinsight.net for public cloud.
$dnsZoneName = "<Replace with private DNS zone name>"
$dnsZoneResourceGroupName = "<Replace with private DNS zone resource group name>"
Connect-AzAccount -SubscriptionId $subscriptionId
# 1. Get cluster endpoints
$clusterEndpoints = $(Get-AzHDInsightCluster -ClusterName $clusterName ` -ResourceGroupName $clusterResourceGroupName).ConnectivityEndpoints
$endpointMapping = @{}
foreach($endpoint in $clusterEndpoints)
{
$label = $endpoint.Location.ToLower().Replace(".$dnsZoneName".ToLower(), "")
$ip = $endpoint.PrivateIPAddress
$endpointMapping.Add($label, $ip)
}
# 2. Confirm that the DNS zone exists.
Get-AzPrivateDnsZone -ResourceGroupName $dnsZoneResourceGroupName -Name $dnsZoneName -ErrorAction Stop
# 3. Update DNS entries for the cluster in the private DNS zone:
# - If the entries already exist, update to the new IP.
# - If the entries don't exist, create them.
$recordSets = Get-AzPrivateDnsRecordSet -ZoneName $dnsZoneName -ResourceGroupName $dnsZoneResourceGroupName -RecordType A
foreach($label in $endpointMapping.Keys)
{
$updateRecord = $null
foreach($record in $recordSets)
{
if($record.Name -eq $label)
{
$updateRecord = $record
break;
}
}
if($null -ne $updateRecord)
{
$updateRecord.Records[0].Ipv4Address = $endpointMapping[$label]
Set-AzPrivateDnsRecordSet -RecordSet $updateRecord | Out-Null
}
else
{
New-AzPrivateDnsRecordSet `
-ResourceGroupName $dnsZoneResourceGroupName `
-ZoneName $dnsZoneName `
-Name $label `
-RecordType A `
-Ttl 3600 `
-PrivateDnsRecord (New-AzPrivateDnsRecordConfig -Ipv4Address $endpointMapping[$label]) | Out-Null
}
}