我正试图使用Powershell脚本在Azure中使用Metastore创建HDInsight集群。但它正在抛出BadRequest.RegionCapabilityNotAvailable,Region capability not available for region 'East US' error。RegionCapabilityNotAvailable,Region capability not available for region 'East US' error。但是美国东部是HDInsight集群支持的区域。请看下面的代码。
$storageAccountResourceGroupName = "hdi-rg"
$storageAccountName = "qwertyhdi"
#$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value
$storageContainer = "qwertyiopasdf-2020-05-03t08-30-23-118z"
# Cluster configuration info
$location = "East US"
$clusterResourceGroupName = "hdi-rg"
$clusterName = "qwertyiopasdf"
$username = "admin"
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$clusterCreds = New-Object System.Management.Automation.PSCredential -ArgumentList ($username, $password)
# Hive metastore info
$hiveSqlServer = "server"
$hiveDb = "db123"
$sqlusername = "qwerty"
$sqlpassword = ConvertTo-SecureString "password" -AsPlainText -Force
$hiveCreds = New-Object System.Management.Automation.PSCredential -ArgumentList ($sqlusername, $sqlpassword)
New-AzStorageAccount `
-ResourceGroupName $storageAccountResourceGroupName `
-Name $storageAccountName `
-Location $location `
-SkuName Standard_LRS `
-Kind StorageV2 `
-EnableHttpsTrafficOnly 1
# Note: Storage account kind BlobStorage cannot be used as primary storage.
$storageAccountKey = (Get-AzStorageAccountKey `
-ResourceGroupName $storageAccountResourceGroupName `
-Name $storageAccountName)[0].Value
$defaultStorageContext = New-AzStorageContext `
-StorageAccountName $storageAccountName `
-StorageAccountKey $storageAccountKey
New-AzStorageContainer `
-Name $storageContainer `
-Context $defaultStorageContext #use the cluster name as the container name
$metastore = New-AzHDInsightClusterConfig | Add-AzHDInsightMetastore -SqlAzureServerName "$hiveSqlServer.database.windows.net" -DatabaseName $hiveDb -Credential $hiveCreds -MetastoreType HiveMetastore
New-AzHDInsightCluster -Location $location -ResourceGroupName $clusterResourceGroupName -ClusterName $clusterName -ClusterType Hadoop -OSType Windows -ClusterSizeInNodes 1 -HttpCredential $clusterCreds -DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" -DefaultStorageAccountKey $storageAccountKey -DefaultStorageContainer $storageContainer -Config $metastore
-OSType Windows是否仍然有效。我意识到 "Windows "被列为PowerShell规范中的一个选项,但我认为 "linux "是唯一能实际工作的值。
您将收到以下错误信息 BadRequest: RegionCapabilityNotAvailable,Region capability not available for region 'East US'
当该订阅中所选区域的底层计算sku不可用时,请检查Azure Portal中的资源是否可用。
我想请你检查资源是否可从Azure门户。
Azure Portal => 选择您的订阅 => 使用情况 + 配额
用 => Microsoft.Compute and Region => 美国东部地区过滤
如果您无法在该区域内找到合适的SKU,或无法找到符合您业务需求的替代区域,请提交 SKU请求 或 增加配额 到 Azure 支持。