I try to create an HDInsight with DataLake store in Automation Runbook but I face an issue.
I already create a Data lake store and certificate in AAD(I have an ObectID and ApplicationID)
# Sign in
$azureUser =
"User name"
#Provide Microsoft account username
$azurePSWD =
$password = ConvertTo-SecureString
"Password" -AsPlainText -Force
#Provide Microsoft Account Password
$azureCredential = New-Object System.Management.Automation.PSCredential ($azureUser,
$azurePSWD)
Login-AzureRmAccount -Credential
$azureCredential
# Select the subscription to use
$subscriptionID =
"SubscriptionID"
# Provide Azure SubscriptionID
Select-AzureRmSubscription -SubscriptionId
$subscriptionID
###########################################
# Create an HDInsight Cluster
###########################################
# Cluster Variables
$resourceGroupName =
"Resource Group Name"
# Provide Resource Group Name
$storageAccountName =
"Storage Account Name"
# Provide Storage Account Name
$storageRootPath =
"path"
# E.g. /clusters/hdiadlcluster
$clusterName =
"cluster name"
$clusterNodes =
1
$clusterUser =
""
# Provide Cluster Username
$clusterSSHUser =
""
# Provide SSH Username
$clusterPSWD = ConvertTo-SecureString
"password" -AsPlainText -Force
# Provide password to use for cluster and ssh if the same
$clusterCredential = New-Object System.Management.Automation.PSCredential ($clusterUser,
$clusterPSWD)
$sshCredential = New-Object System.Management.Automation.PSCredential ($clusterSSHUser,
$clusterPSWD)
$clusterType =
"Hadoop"
$clusterOS =
"Linux"
$clusterNodeSize =
"Standard_A3"
$location =
"Central US"
####################################
# DataLake store credential
####################################
$tenantID = (Get-AzureRmContext).Tenant.TenantId
Write-Output
$tenantid
$CertPath =
"C:\\mycertificate.pfx"
$cert = Get-AutomationCertificate -Name
'mycertificate'
Write-Output
$cert
$certPassword =
"password"
$PfxCert =
$cert.Export("pfx",$certPassword)
Set-Content -Value
$PfxCert -Path
$CertPath -Force -Encoding Byte | Write-Verbose
dir
$CertPath
$applicationid =
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$servicePrincipalobjectId =
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
New-AzureRmHDInsightCluster -ClusterName
$clusterName -ResourceGroupName
$resourceGroupName -HttpCredential
$clusterCredential -Location
$location -DefaultStorageAccountType AzureDataLakeStore -DefaultStorageAccountName
"sfcsdls.azuredatalakestore.net" -DefaultStorageRootPath
$storageRootPath -ClusterSizeInNodes
$clusterNodes -ClusterType
$clusterType -OSType
$clusterOS -Version
"3.6" -SshCredential
$sshCredential -HeadNodeSize
$clusterNodeSize -WorkerNodeSize
$clusterNodeSize -ObjectId
$servicePrincipalobjectId -CertificateFilePath
$cert -CertificatePassword
$certPassword -AadTenantId
$tenantID
################################
The OUTPUT Error:
New-AzureRmHDInsightCluster : Operation returned an invalid status code 'NotFound'
At line:66 char:1
+ New-AzureRmHDInsightCluster -ClusterName $clusterName -ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmHDInsightCluster], GraphErrorException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.HDInsight.NewAzureHDInsightClusterCommand