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:
⚠️
windows_first
⚠️
powershell_heavy
⚠️
windows_tools
Summary:
The documentation provides both Bash and PowerShell examples throughout, but there is a consistent pattern of mentioning Windows-specific tools and environments (such as Bash on Ubuntu on Windows 10, Windows PowerShell, and explicit references to Windows paths for jq) before or alongside Linux-native alternatives. The prerequisites and setup sections prioritize Windows environments, and some instructions (e.g., jq path in PowerShell) are tailored for Windows users. There are no missing Linux examples, but the overall framing and tool recommendations are Windows-centric.
Recommendations:
- In the prerequisites, mention native Linux environments (e.g., Ubuntu, CentOS) before or alongside Windows Subsystem for Linux, and clarify that all Bash examples work natively on Linux.
- When referencing tools like jq, provide installation instructions or links for both Linux and Windows, not just Windows.
- Avoid Windows-specific paths (e.g., C:\HD\jq\jq-win64) in PowerShell examples, or provide equivalent Linux paths for parity.
- When listing shell options, avoid phrasing that implies Windows is the primary or default environment (e.g., 'Bash on Ubuntu on Windows 10' as the main example).
- Consider providing a dedicated section or callout for Linux users, especially in setup and prerequisites.
- Where possible, clarify that all examples are cross-platform unless otherwise noted, and ensure Linux is not presented as an afterthought.
Create pull request
Flagged Code Snippets
# Identify properly cased cluster name
$resp = Invoke-WebRequest -Uri "https://CLUSTERNAME.azurehdinsight.net/api/v1/clusters" `
-Credential $creds -UseBasicParsing
$clusterName = (ConvertFrom-Json $resp.Content).items.Clusters.cluster_name;
# Show cluster name
$clusterName
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.Clusters.health_report
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/hosts" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.items.Hosts.host_name
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/HDFS/components/NAMENODE" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.host_components.HostRoles.host_name
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/HDFS/components/DATANODE" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.host_components.HostRoles.host_name
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/ZOOKEEPER/components/ZOOKEEPER_SERVER" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.host_components.HostRoles.host_name
$uri = "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/hosts"
$resp = Invoke-WebRequest -Uri $uri -Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
foreach($item in $respObj.items) {
$hostName = [string]$item.Hosts.host_name
$hostInfoResp = Invoke-WebRequest -Uri "$uri/$hostName" `
-Credential $creds -UseBasicParsing
$hostInfoObj = ConvertFrom-Json $hostInfoResp
$hostIp = $hostInfoObj.Hosts.ip
"$hostName <--> $hostIp"
}
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/configurations/service_config_versions?service_name=HDFS&service_config_version=1" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.items.configurations.properties.'fs.defaultFS'
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/configurations/service_config_versions?service_name=HDFS&service_config_version=1" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.items.configurations.properties.'dfs.adls.home.hostname'
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/configurations/service_config_versions?service_name=HDFS&service_config_version=1" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.items.configurations.properties.'dfs.adls.home.mountpoint'
$respObj = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName`?fields=Clusters/desired_configs" `
-Credential $creds -UseBasicParsing
$respObj.Content
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/configurations?type=livy2-conf&tag=INITIAL" `
-Credential $creds -UseBasicParsing
$resp.Content
$newConfig = Get-Content .\newconfig.json
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName" `
-Credential $creds -UseBasicParsing `
-Method PUT `
-Headers @{"X-Requested-By" = "ambari"} `
-Body $newConfig
$resp.Content
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/SPARK2" `
-Credential $creds -UseBasicParsing `
-Method PUT `
-Headers @{"X-Requested-By" = "ambari"} `
-Body '{"RequestInfo": {"context": "turning on maintenance mode for SPARK2"},"Body": {"ServiceInfo": {"maintenance_state":"ON"}}}'
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/SPARK2" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.ServiceInfo.maintenance_state
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/SPARK2" `
-Credential $creds -UseBasicParsing `
-Method PUT `
-Headers @{"X-Requested-By" = "ambari"} `
-Body '{"RequestInfo":{"context":"_PARSE_.STOP.SPARK2","operation_level":{"level":"SERVICE","cluster_name":"CLUSTERNAME","service_name":"SPARK"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}'
$resp.Content
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/requests/29" `
-Credential $creds -UseBasicParsing
$respObj = ConvertFrom-Json $resp.Content
$respObj.Requests.request_status
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/SPARK2" `
-Credential $creds -UseBasicParsing `
-Method PUT `
-Headers @{"X-Requested-By" = "ambari"} `
-Body '{"RequestInfo":{"context":"_PARSE_.START.SPARK2","operation_level":{"level":"SERVICE","cluster_name":"CLUSTERNAME","service_name":"SPARK"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}'
$resp.Content
$resp = Invoke-WebRequest -Uri "https://$clusterName.azurehdinsight.net/api/v1/clusters/$clusterName/services/SPARK2" `
-Credential $creds -UseBasicParsing `
-Method PUT `
-Headers @{"X-Requested-By" = "ambari"} `
-Body '{"RequestInfo": {"context": "turning off maintenance mode for SPARK2"},"Body": {"ServiceInfo": {"maintenance_state":"OFF"}}}'
$creds = Get-Credential -UserName "admin" -Message "Enter the HDInsight login"