Erstellt einen neuen HDInsight-Cluster mit den angegebenen Parametern.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}?api-version=2021-06-01
URI-Parameter
| Name |
In |
Erforderlich |
Typ |
Beschreibung |
|
clusterName
|
path |
True
|
string
|
Der Name des Clusters.
|
|
resourceGroupName
|
path |
True
|
string
|
Der Name der Ressourcengruppe.
|
|
subscriptionId
|
path |
True
|
string
|
Die Abonnementanmeldeinformationen, die das Microsoft Azure-Abonnement eindeutig identifizieren. Die Abonnement-ID ist Teil des URI für jeden Dienstaufruf.
|
|
api-version
|
query |
True
|
string
|
Die HDInsight-Client-API-Version.
|
Anforderungstext
| Name |
Typ |
Beschreibung |
|
identity
|
ClusterIdentity
|
Die Identität des Clusters, falls konfiguriert.
|
|
location
|
string
|
Die Position des Clusters.
|
|
properties
|
ClusterCreateProperties
|
Der Cluster erstellt Parameter.
|
|
tags
|
object
|
Die Ressourcentags.
|
|
zones
|
string[]
|
Die Verfügbarkeitszonen.
|
Antworten
| Name |
Typ |
Beschreibung |
|
200 OK
|
Cluster
|
OK-Antwortdefinition.
|
|
Other Status Codes
|
ErrorResponse
|
Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist.
|
Sicherheit
azure_auth
Azure Active Directory OAuth2-Fluss
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
| Name |
Beschreibung |
|
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
Create cluster with availability zones
Beispielanforderung
PUT https://management.azure.com/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"zones": [
"1"
],
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"clusterDefinition": {
"kind": "hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
},
"ambari-conf": {
"database-server": "{sql server name}.database.windows.net",
"database-name": "{ambari database name}",
"database-user-name": "**********",
"database-user-password": "**********"
},
"hive-site": {
"javax.jdo.option.ConnectionURL": "jdbc:sqlserver://{sql server name}.database.windows.net;database={hive metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"javax.jdo.option.ConnectionUserName": "**********",
"javax.jdo.option.ConnectionPassword": "**********!",
"javax.jdo.option.ConnectionDriverName": "com.microsoft.sqlserver.jdbc.SQLServerDriver"
},
"hive-env": {
"hive_database": "Existing MSSQL Server database with SQL authentication",
"hive_database_name": "{hive metastore name}",
"hive_database_type": "mssql",
"hive_existing_mssql_server_database": "{hive metastore name}",
"hive_existing_mssql_server_host": "{sql server name}.database.windows.net",
"hive_hostname": "{sql server name}.database.windows.net"
},
"oozie-site": {
"oozie.service.JPAService.jdbc.url": "jdbc:sqlserver://{sql server name}.database.windows.net;database={oozie metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"oozie.service.JPAService.jdbc.username": "**********",
"oozie.service.JPAService.jdbc.password": "**********",
"oozie.service.JPAService.jdbc.driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"oozie.db.schema.name": "oozie"
},
"oozie-env": {
"oozie_database": "Existing MSSQL Server database with SQL authentication",
"oozie_database_name": "{oozie metastore name}",
"oozie_database_type": "mssql",
"oozie_existing_mssql_server_database": "{oozie metastore name}",
"oozie_existing_mssql_server_host": "{sql server name}.database.windows.net",
"oozie_hostname": "{sql server name}.database.windows.net"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage",
"isDefault": true,
"container": "containername",
"key": "storage account key"
}
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
},
{
"name": "workernode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.SshProfile;
import com.azure.resourcemanager.hdinsight.models.SshPublicKey;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.VirtualNetworkProfile;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAvailabilityZones.json
*/
/**
* Sample code: Create cluster with availability zones.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createClusterWithAvailabilityZones(com.azure.resourcemanager.hdinsight.HDInsightManager manager)
throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withZones(Arrays.asList("1"))
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withClusterDefinition(
new ClusterDefinition()
.withKind("hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"ambari-conf\":{\"database-name\":\"{ambari database"
+ " name}\",\"database-server\":\"{sql server"
+ " name}.database.windows.net\",\"database-user-name\":\"**********\",\"database-user-password\":\"**********\"},\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"},\"hive-env\":{\"hive_database\":\"Existing"
+ " MSSQL Server database with SQL"
+ " authentication\",\"hive_database_name\":\"{hive metastore"
+ " name}\",\"hive_database_type\":\"mssql\",\"hive_existing_mssql_server_database\":\"{hive"
+ " metastore name}\",\"hive_existing_mssql_server_host\":\"{sql server"
+ " name}.database.windows.net\",\"hive_hostname\":\"{sql server"
+ " name}.database.windows.net\"},\"hive-site\":{\"javax.jdo.option.ConnectionDriverName\":\"com.microsoft.sqlserver.jdbc.SQLServerDriver\",\"javax.jdo.option.ConnectionPassword\":\"**********!\",\"javax.jdo.option.ConnectionURL\":\"jdbc:sqlserver://{sql"
+ " server name}.database.windows.net;database={hive metastore"
+ " name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0\",\"javax.jdo.option.ConnectionUserName\":\"**********\"},\"oozie-env\":{\"oozie_database\":\"Existing"
+ " MSSQL Server database with SQL"
+ " authentication\",\"oozie_database_name\":\"{oozie metastore"
+ " name}\",\"oozie_database_type\":\"mssql\",\"oozie_existing_mssql_server_database\":\"{oozie"
+ " metastore name}\",\"oozie_existing_mssql_server_host\":\"{sql server"
+ " name}.database.windows.net\",\"oozie_hostname\":\"{sql server"
+ " name}.database.windows.net\"},\"oozie-site\":{\"oozie.db.schema.name\":\"oozie\",\"oozie.service.JPAService.jdbc.driver\":\"com.microsoft.sqlserver.jdbc.SQLServerDriver\",\"oozie.service.JPAService.jdbc.password\":\"**********\",\"oozie.service.JPAService.jdbc.url\":\"jdbc:sqlserver://{sql"
+ " server name}.database.windows.net;database={oozie metastore"
+ " name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0\",\"oozie.service.JPAService.jdbc.username\":\"**********\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("standard_d3"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********"))))))
.withVirtualNetworkProfile(
new VirtualNetworkProfile()
.withId(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname")
.withSubnet(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet")),
new Role()
.withName("workernode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("standard_d3"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********"))))))
.withVirtualNetworkProfile(
new VirtualNetworkProfile()
.withId(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname")
.withSubnet(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet")))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_hd_insight_cluster_with_availability_zones.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subId",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"ambari-conf": {
"database-name": "{ambari database name}",
"database-server": "{sql server name}.database.windows.net",
"database-user-name": "**********",
"database-user-password": "**********",
},
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
"hive-env": {
"hive_database": "Existing MSSQL Server database with SQL authentication",
"hive_database_name": "{hive metastore name}",
"hive_database_type": "mssql",
"hive_existing_mssql_server_database": "{hive metastore name}",
"hive_existing_mssql_server_host": "{sql server name}.database.windows.net",
"hive_hostname": "{sql server name}.database.windows.net",
},
"hive-site": {
"javax.jdo.option.ConnectionDriverName": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"javax.jdo.option.ConnectionPassword": "**********!",
"javax.jdo.option.ConnectionURL": "jdbc:sqlserver://{sql server name}.database.windows.net;database={hive metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"javax.jdo.option.ConnectionUserName": "**********",
},
"oozie-env": {
"oozie_database": "Existing MSSQL Server database with SQL authentication",
"oozie_database_name": "{oozie metastore name}",
"oozie_database_type": "mssql",
"oozie_existing_mssql_server_database": "{oozie metastore name}",
"oozie_existing_mssql_server_host": "{sql server name}.database.windows.net",
"oozie_hostname": "{sql server name}.database.windows.net",
},
"oozie-site": {
"oozie.db.schema.name": "oozie",
"oozie.service.JPAService.jdbc.driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"oozie.service.JPAService.jdbc.password": "**********",
"oozie.service.JPAService.jdbc.url": "jdbc:sqlserver://{sql server name}.database.windows.net;database={oozie metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"oozie.service.JPAService.jdbc.username": "**********",
},
},
"kind": "hadoop",
},
"clusterVersion": "3.6",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "standard_d3"},
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"targetInstanceCount": 2,
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
"hardwareProfile": {"vmSize": "standard_d3"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"targetInstanceCount": 2,
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
]
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storage account key",
"name": "mystorage",
}
]
},
},
"zones": ["1"],
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAvailabilityZones.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAvailabilityZones.json
func ExampleClustersClient_BeginCreate_createClusterWithAvailabilityZones() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"ambari-conf": map[string]any{
"database-name": "{ambari database name}",
"database-server": "{sql server name}.database.windows.net",
"database-user-name": "**********",
"database-user-password": "**********",
},
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
"hive-env": map[string]any{
"hive_database": "Existing MSSQL Server database with SQL authentication",
"hive_database_name": "{hive metastore name}",
"hive_database_type": "mssql",
"hive_existing_mssql_server_database": "{hive metastore name}",
"hive_existing_mssql_server_host": "{sql server name}.database.windows.net",
"hive_hostname": "{sql server name}.database.windows.net",
},
"hive-site": map[string]any{
"javax.jdo.option.ConnectionDriverName": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"javax.jdo.option.ConnectionPassword": "**********!",
"javax.jdo.option.ConnectionURL": "jdbc:sqlserver://{sql server name}.database.windows.net;database={hive metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"javax.jdo.option.ConnectionUserName": "**********",
},
"oozie-env": map[string]any{
"oozie_database": "Existing MSSQL Server database with SQL authentication",
"oozie_database_name": "{oozie metastore name}",
"oozie_database_type": "mssql",
"oozie_existing_mssql_server_database": "{oozie metastore name}",
"oozie_existing_mssql_server_host": "{sql server name}.database.windows.net",
"oozie_hostname": "{sql server name}.database.windows.net",
},
"oozie-site": map[string]any{
"oozie.db.schema.name": "oozie",
"oozie.service.JPAService.jdbc.driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"oozie.service.JPAService.jdbc.password": "**********",
"oozie.service.JPAService.jdbc.url": "jdbc:sqlserver://{sql server name}.database.windows.net;database={oozie metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"oozie.service.JPAService.jdbc.username": "**********",
},
},
Kind: to.Ptr("hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("standard_d3"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
},
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("standard_d3"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
},
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storage account key"),
}},
},
},
Zones: []*string{
to.Ptr("1")},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("South Central US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json"),
// Kind: to.Ptr("hadoop"),
// },
// ClusterID: to.Ptr("8186508b6234470e9d16c9e8e13bd821"),
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("3.6.1000.67"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
// ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
// Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
// },
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
// ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
// Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
// },
// }},
// },
// CreatedDate: to.Ptr("2020-06-09T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](16),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// Zones: []*string{
// to.Ptr("1")},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAvailabilityZones.json
*/
async function createClusterWithAvailabilityZones() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subId";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
"ambari-conf": {
"database-name": "{ambari database name}",
"database-server": "{sql server name}.database.windows.net",
"database-user-name": "**********",
"database-user-password": "**********",
},
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
"hive-env": {
hive_database: "Existing MSSQL Server database with SQL authentication",
hive_database_name: "{hive metastore name}",
hive_database_type: "mssql",
hive_existing_mssql_server_database: "{hive metastore name}",
hive_existing_mssql_server_host: "{sql server name}.database.windows.net",
hive_hostname: "{sql server name}.database.windows.net",
},
"hive-site": {
"javax.jdo.option.ConnectionDriverName": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"javax.jdo.option.ConnectionPassword": "**********!",
"javax.jdo.option.ConnectionURL":
"jdbc:sqlserver://{sql server name}.database.windows.net;database={hive metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"javax.jdo.option.ConnectionUserName": "**********",
},
"oozie-env": {
oozie_database: "Existing MSSQL Server database with SQL authentication",
oozie_database_name: "{oozie metastore name}",
oozie_database_type: "mssql",
oozie_existing_mssql_server_database: "{oozie metastore name}",
oozie_existing_mssql_server_host: "{sql server name}.database.windows.net",
oozie_hostname: "{sql server name}.database.windows.net",
},
"oozie-site": {
"oozie.db.schema.name": "oozie",
"oozie.service.JPAService.jdbc.driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
"oozie.service.JPAService.jdbc.password": "**********",
"oozie.service.JPAService.jdbc.url":
"jdbc:sqlserver://{sql server name}.database.windows.net;database={oozie metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
"oozie.service.JPAService.jdbc.username": "**********",
},
},
kind: "hadoop",
},
clusterVersion: "3.6",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "standard_d3" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
targetInstanceCount: 2,
virtualNetworkProfile: {
id: "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
subnet:
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
name: "workernode",
hardwareProfile: { vmSize: "standard_d3" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
targetInstanceCount: 2,
virtualNetworkProfile: {
id: "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
subnet:
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
],
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage",
container: "containername",
isDefault: true,
key: "storage account key",
},
],
},
},
zones: ["1"],
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAvailabilityZones.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subId";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Zones =
{
"1"
},
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["ambari-conf"] = new Dictionary<string, object>()
{
["database-name"] = "{ambari database name}",
["database-server"] = "{sql server name}.database.windows.net",
["database-user-name"] = "**********",
["database-user-password"] = "**********"
},
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
},
["hive-env"] = new Dictionary<string, object>()
{
["hive_database"] = "Existing MSSQL Server database with SQL authentication",
["hive_database_name"] = "{hive metastore name}",
["hive_database_type"] = "mssql",
["hive_existing_mssql_server_database"] = "{hive metastore name}",
["hive_existing_mssql_server_host"] = "{sql server name}.database.windows.net",
["hive_hostname"] = "{sql server name}.database.windows.net"
},
["hive-site"] = new Dictionary<string, object>()
{
["javax.jdo.option.ConnectionDriverName"] = "com.microsoft.sqlserver.jdbc.SQLServerDriver",
["javax.jdo.option.ConnectionPassword"] = "**********!",
["javax.jdo.option.ConnectionURL"] = "jdbc:sqlserver://{sql server name}.database.windows.net;database={hive metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
["javax.jdo.option.ConnectionUserName"] = "**********"
},
["oozie-env"] = new Dictionary<string, object>()
{
["oozie_database"] = "Existing MSSQL Server database with SQL authentication",
["oozie_database_name"] = "{oozie metastore name}",
["oozie_database_type"] = "mssql",
["oozie_existing_mssql_server_database"] = "{oozie metastore name}",
["oozie_existing_mssql_server_host"] = "{sql server name}.database.windows.net",
["oozie_hostname"] = "{sql server name}.database.windows.net"
},
["oozie-site"] = new Dictionary<string, object>()
{
["oozie.db.schema.name"] = "oozie",
["oozie.service.JPAService.jdbc.driver"] = "com.microsoft.sqlserver.jdbc.SQLServerDriver",
["oozie.service.JPAService.jdbc.password"] = "**********",
["oozie.service.JPAService.jdbc.url"] = "jdbc:sqlserver://{sql server name}.database.windows.net;database={oozie metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0",
["oozie.service.JPAService.jdbc.username"] = "**********"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
TargetInstanceCount = 2,
HardwareVmSize = "standard_d3",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
VirtualNetworkProfile = new HDInsightVirtualNetworkProfile()
{
Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet = "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 2,
HardwareVmSize = "standard_d3",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
VirtualNetworkProfile = new HDInsightVirtualNetworkProfile()
{
Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet = "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage",
IsDefault = true,
Container = "containername",
Key = "storage account key",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "South Central US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"tags": null,
"zones": [
"1"
],
"properties": {
"clusterVersion": "3.6.1000.67",
"osType": "Linux",
"clusterId": "8186508b6234470e9d16c9e8e13bd821",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json",
"kind": "hadoop"
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
},
{
"name": "workernode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2020-06-09T12:25:43.48",
"quotaInfo": {
"coresUsed": 16
},
"tier": "Standard"
}
}
Create cluster with compute isolation properties
Beispielanforderung
PUT https://management.azure.com/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"clusterDefinition": {
"kind": "hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage",
"isDefault": true,
"container": "containername",
"key": "storage account key"
}
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
}
},
{
"name": "workernode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
}
}
]
},
"computeIsolationProperties": {
"enableComputeIsolation": true,
"hostSku": null
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeIsolationProperties;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.SshProfile;
import com.azure.resourcemanager.hdinsight.models.SshPublicKey;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithComputeIsolationProperties.json
*/
/**
* Sample code: Create cluster with compute isolation properties.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createClusterWithComputeIsolationProperties(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withClusterDefinition(
new ClusterDefinition()
.withKind("hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("standard_d3"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********")))))),
new Role()
.withName("workernode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("standard_d3"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********")))))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder"))))
.withComputeIsolationProperties(new ComputeIsolationProperties().withEnableComputeIsolation(true)))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_hd_insight_cluster_with_compute_isolation_properties.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subId",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "hadoop",
},
"clusterVersion": "3.6",
"computeIsolationProperties": {"enableComputeIsolation": True, "hostSku": None},
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "standard_d3"},
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "standard_d3"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"targetInstanceCount": 2,
},
]
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storage account key",
"name": "mystorage",
}
]
},
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithComputeIsolationProperties.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithComputeIsolationProperties.json
func ExampleClustersClient_BeginCreate_createClusterWithComputeIsolationProperties() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeIsolationProperties: &armhdinsight.ComputeIsolationProperties{
EnableComputeIsolation: to.Ptr(true),
},
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("standard_d3"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("standard_d3"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storage account key"),
}},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("South Central US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json"),
// Kind: to.Ptr("hadoop"),
// },
// ClusterID: to.Ptr("8186508b6234470e9d16c9e8e13bd821"),
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("3.6.1000.67"),
// ComputeIsolationProperties: &armhdinsight.ComputeIsolationProperties{
// EnableComputeIsolation: to.Ptr(true),
// },
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
// ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
// Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
// },
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// }},
// },
// CreatedDate: to.Ptr("2020-06-09T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](16),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithComputeIsolationProperties.json
*/
async function createClusterWithComputeIsolationProperties() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subId";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "hadoop",
},
clusterVersion: "3.6",
computeIsolationProperties: {
enableComputeIsolation: true,
hostSku: undefined,
},
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "standard_d3" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "standard_d3" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
targetInstanceCount: 2,
},
],
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage",
container: "containername",
isDefault: true,
key: "storage account key",
},
],
},
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithComputeIsolationProperties.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subId";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
TargetInstanceCount = 2,
HardwareVmSize = "standard_d3",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
},new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 2,
HardwareVmSize = "standard_d3",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage",
IsDefault = true,
Container = "containername",
Key = "storage account key",
}
},
ComputeIsolationProperties = new HDInsightComputeIsolationProperties()
{
EnableComputeIsolation = true,
HostSku = null,
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "South Central US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"tags": null,
"properties": {
"clusterVersion": "3.6.1000.67",
"osType": "Linux",
"clusterId": "8186508b6234470e9d16c9e8e13bd821",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json",
"kind": "hadoop"
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
},
{
"name": "workernode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"computeIsolationProperties": {
"enableComputeIsolation": true,
"hostSku": null
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2020-06-09T12:25:43.48",
"quotaInfo": {
"coresUsed": 16
},
"tier": "Standard"
}
}
Create cluster with encryption at host
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "Hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Standard_DS14_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Standard_DS14_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Standard_DS14_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
}
]
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "default8525",
"key": "storagekey"
}
]
},
"diskEncryptionProperties": {
"encryptionAtHost": true
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.DiskEncryptionProperties;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionAtHost.json
*/
/**
* Sample code: Create cluster with encryption at host.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createClusterWithEncryptionAtHost(com.azure.resourcemanager.hdinsight.HDInsightManager manager)
throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_DS14_v2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("workernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_DS14_v2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("zookeepernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_DS14_v2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("default8525")
.withKey("fakeTokenPlaceholder"))))
.withDiskEncryptionProperties(new DiskEncryptionProperties().withEncryptionAtHost(true)))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_hd_insight_cluster_with_encryption_at_host.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Hadoop",
},
"clusterVersion": "3.6",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Standard_DS14_v2"},
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "Standard_DS14_v2"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
{
"hardwareProfile": {"vmSize": "Standard_DS14_v2"},
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
]
},
"diskEncryptionProperties": {"encryptionAtHost": True},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "default8525",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionAtHost.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionAtHost.json
func ExampleClustersClient_BeginCreate_createClusterWithEncryptionAtHost() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_DS14_v2"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_DS14_v2"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_DS14_v2"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
}},
},
DiskEncryptionProperties: &armhdinsight.DiskEncryptionProperties{
EncryptionAtHost: to.Ptr(true),
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("default8525"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("South Central US"),
// Etag: to.Ptr("3b76ce3d-892c-4036-9d8b-8ade18ba7a4b"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("2.7"),
// },
// Kind: to.Ptr("Hadoop"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("3.6.1000.67"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_ds14_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_ds14_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_ds14_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2020-01-10T08:36:39.153"),
// DiskEncryptionProperties: &armhdinsight.DiskEncryptionProperties{
// EncryptionAtHost: to.Ptr(true),
// },
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](20),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionAtHost.json
*/
async function createClusterWithEncryptionAtHost() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Hadoop",
},
clusterVersion: "3.6",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Standard_DS14_v2" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "Standard_DS14_v2" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Standard_DS14_v2" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
],
},
diskEncryptionProperties: { encryptionAtHost: true },
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "default8525",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionAtHost.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
TargetInstanceCount = 2,
HardwareVmSize = "Standard_DS14_v2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 3,
HardwareVmSize = "Standard_DS14_v2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
TargetInstanceCount = 3,
HardwareVmSize = "Standard_DS14_v2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "default8525",
Key = "storagekey",
}
},
DiskEncryptionProperties = new HDInsightDiskEncryptionProperties()
{
IsEncryptionAtHostEnabled = true,
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "South Central US",
"etag": "3b76ce3d-892c-4036-9d8b-8ade18ba7a4b",
"tags": null,
"properties": {
"clusterVersion": "3.6.1000.67",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json",
"kind": "Hadoop",
"componentVersion": {
"Hadoop": "2.7"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_ds14_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_ds14_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_ds14_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2020-01-10T08:36:39.153",
"quotaInfo": {
"coresUsed": 20
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard",
"diskEncryptionProperties": {
"vaultUri": null,
"keyName": null,
"keyVersion": null,
"encryptionAlgorithm": null,
"msiResourceId": null,
"encryptionAtHost": true
}
}
}
Create cluster with encryption in transit
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "Hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Large"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Large"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Small"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
}
]
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "default8525",
"key": "storagekey"
}
]
},
"encryptionInTransitProperties": {
"isEncryptionInTransitEnabled": true
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.EncryptionInTransitProperties;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionInTransit.json
*/
/**
* Sample code: Create cluster with encryption in transit.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createClusterWithEncryptionInTransit(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Large"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("workernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Large"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("zookeepernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Small"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("default8525")
.withKey("fakeTokenPlaceholder"))))
.withEncryptionInTransitProperties(
new EncryptionInTransitProperties().withIsEncryptionInTransitEnabled(true)))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_hd_insight_cluster_with_encryption_in_transit.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Hadoop",
},
"clusterVersion": "3.6",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Large"},
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "Large"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
{
"hardwareProfile": {"vmSize": "Small"},
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
]
},
"encryptionInTransitProperties": {"isEncryptionInTransitEnabled": True},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "default8525",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionInTransit.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionInTransit.json
func ExampleClustersClient_BeginCreate_createClusterWithEncryptionInTransit() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Large"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Large"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Small"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
}},
},
EncryptionInTransitProperties: &armhdinsight.EncryptionInTransitProperties{
IsEncryptionInTransitEnabled: to.Ptr(true),
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("default8525"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("South Central US"),
// Etag: to.Ptr("3b76ce3d-892c-4036-9d8b-8ade18ba7a4b"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("2.7"),
// },
// Kind: to.Ptr("Hadoop"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("3.6.1000.67"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2020-01-10T08:36:39.153"),
// EncryptionInTransitProperties: &armhdinsight.EncryptionInTransitProperties{
// IsEncryptionInTransitEnabled: to.Ptr(true),
// },
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](20),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionInTransit.json
*/
async function createClusterWithEncryptionInTransit() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Hadoop",
},
clusterVersion: "3.6",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Large" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "Large" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Small" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
],
},
encryptionInTransitProperties: { isEncryptionInTransitEnabled: true },
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "default8525",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithEncryptionInTransit.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
TargetInstanceCount = 2,
HardwareVmSize = "Large",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 3,
HardwareVmSize = "Large",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
TargetInstanceCount = 3,
HardwareVmSize = "Small",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "default8525",
Key = "storagekey",
}
},
IsEncryptionInTransitEnabled = true,
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "South Central US",
"etag": "3b76ce3d-892c-4036-9d8b-8ade18ba7a4b",
"tags": null,
"properties": {
"clusterVersion": "3.6.1000.67",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json",
"kind": "Hadoop",
"componentVersion": {
"Hadoop": "2.7"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_a4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2020-01-10T08:36:39.153",
"quotaInfo": {
"coresUsed": 20
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard",
"encryptionInTransitProperties": {
"isEncryptionInTransitEnabled": true
}
}
}
Create cluster with network properties
Beispielanforderung
PUT https://management.azure.com/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"clusterDefinition": {
"kind": "hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage",
"isDefault": true,
"container": "containername",
"key": "storage account key"
}
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
},
{
"name": "workernode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
}
]
},
"networkProperties": {
"resourceProviderConnection": "Outbound",
"privateLink": "Enabled"
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.NetworkProperties;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.PrivateLink;
import com.azure.resourcemanager.hdinsight.models.ResourceProviderConnection;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.SshProfile;
import com.azure.resourcemanager.hdinsight.models.SshPublicKey;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.VirtualNetworkProfile;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithCustomNetworkProperties.json
*/
/**
* Sample code: Create cluster with network properties.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createClusterWithNetworkProperties(com.azure.resourcemanager.hdinsight.HDInsightManager manager)
throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withClusterDefinition(
new ClusterDefinition()
.withKind("hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("standard_d3"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********"))))))
.withVirtualNetworkProfile(
new VirtualNetworkProfile()
.withId(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname")
.withSubnet(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet")),
new Role()
.withName("workernode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("standard_d3"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********"))))))
.withVirtualNetworkProfile(
new VirtualNetworkProfile()
.withId(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname")
.withSubnet(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet")))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder"))))
.withNetworkProperties(
new NetworkProperties()
.withResourceProviderConnection(ResourceProviderConnection.OUTBOUND)
.withPrivateLink(PrivateLink.ENABLED)))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_hd_insight_cluster_with_custom_network_properties.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subId",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "hadoop",
},
"clusterVersion": "3.6",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "standard_d3"},
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"targetInstanceCount": 2,
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
"hardwareProfile": {"vmSize": "standard_d3"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"targetInstanceCount": 2,
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
]
},
"networkProperties": {"privateLink": "Enabled", "resourceProviderConnection": "Outbound"},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storage account key",
"name": "mystorage",
}
]
},
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithCustomNetworkProperties.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithCustomNetworkProperties.json
func ExampleClustersClient_BeginCreate_createClusterWithNetworkProperties() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("standard_d3"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
},
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("standard_d3"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
},
}},
},
NetworkProperties: &armhdinsight.NetworkProperties{
PrivateLink: to.Ptr(armhdinsight.PrivateLinkEnabled),
ResourceProviderConnection: to.Ptr(armhdinsight.ResourceProviderConnectionOutbound),
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storage account key"),
}},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("South Central US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json"),
// Kind: to.Ptr("hadoop"),
// },
// ClusterID: to.Ptr("8186508b6234470e9d16c9e8e13bd821"),
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("3.6.1000.67"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
// ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
// Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
// },
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
// ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
// Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
// },
// }},
// },
// CreatedDate: to.Ptr("2020-06-09T12:25:43.48"),
// NetworkProperties: &armhdinsight.NetworkProperties{
// PrivateLink: to.Ptr(armhdinsight.PrivateLinkEnabled),
// ResourceProviderConnection: to.Ptr(armhdinsight.ResourceProviderConnectionOutbound),
// },
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](16),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithCustomNetworkProperties.json
*/
async function createClusterWithNetworkProperties() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subId";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "hadoop",
},
clusterVersion: "3.6",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "standard_d3" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
targetInstanceCount: 2,
virtualNetworkProfile: {
id: "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
subnet:
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
name: "workernode",
hardwareProfile: { vmSize: "standard_d3" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
targetInstanceCount: 2,
virtualNetworkProfile: {
id: "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
subnet:
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
],
},
networkProperties: {
privateLink: "Enabled",
resourceProviderConnection: "Outbound",
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage",
container: "containername",
isDefault: true,
key: "storage account key",
},
],
},
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithCustomNetworkProperties.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subId";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
TargetInstanceCount = 2,
HardwareVmSize = "standard_d3",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
VirtualNetworkProfile = new HDInsightVirtualNetworkProfile()
{
Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet = "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 2,
HardwareVmSize = "standard_d3",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
VirtualNetworkProfile = new HDInsightVirtualNetworkProfile()
{
Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet = "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage",
IsDefault = true,
Container = "containername",
Key = "storage account key",
}
},
NetworkProperties = new HDInsightClusterNetworkProperties()
{
ResourceProviderConnection = HDInsightResourceProviderConnection.Outbound,
PrivateLink = HDInsightPrivateLinkState.Enabled,
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "South Central US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"tags": null,
"properties": {
"clusterVersion": "3.6.1000.67",
"osType": "Linux",
"clusterId": "8186508b6234470e9d16c9e8e13bd821",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json",
"kind": "hadoop"
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
},
{
"name": "workernode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
}
}
]
},
"networkProperties": {
"resourceProviderConnection": "Outbound",
"privateLink": "Enabled"
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2020-06-09T12:25:43.48",
"quotaInfo": {
"coresUsed": 16
},
"tier": "Standard"
}
}
Create cluster with TLS 1.2
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "Hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Large"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Large"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Small"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
}
]
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "default8525",
"key": "storagekey"
}
]
},
"minSupportedTlsVersion": "1.2"
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithTLS12.json
*/
/**
* Sample code: Create cluster with TLS 1.2.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createClusterWithTLS12(com.azure.resourcemanager.hdinsight.HDInsightManager manager)
throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Large"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("workernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Large"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("zookeepernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Small"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("default8525")
.withKey("fakeTokenPlaceholder"))))
.withMinSupportedTlsVersion("1.2"))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_hd_insight_cluster_with_tls12.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Hadoop",
},
"clusterVersion": "3.6",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Large"},
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "Large"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
{
"hardwareProfile": {"vmSize": "Small"},
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
]
},
"minSupportedTlsVersion": "1.2",
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "default8525",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithTLS12.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithTLS12.json
func ExampleClustersClient_BeginCreate_createClusterWithTls12() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Large"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Large"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Small"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
}},
},
MinSupportedTLSVersion: to.Ptr("1.2"),
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("default8525"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("South Central US"),
// Etag: to.Ptr("3b76ce3d-892c-4036-9d8b-8ade18ba7a4b"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("2.7"),
// },
// Kind: to.Ptr("Hadoop"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("3.6.1000.67"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2020-01-10T08:36:39.153"),
// MinSupportedTLSVersion: to.Ptr("1.2"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](20),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithTLS12.json
*/
async function createClusterWithTls12() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Hadoop",
},
clusterVersion: "3.6",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Large" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "Large" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Small" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
],
},
minSupportedTlsVersion: "1.2",
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "default8525",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithTLS12.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
TargetInstanceCount = 2,
HardwareVmSize = "Large",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 3,
HardwareVmSize = "Large",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
TargetInstanceCount = 3,
HardwareVmSize = "Small",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "default8525",
Key = "storagekey",
}
},
MinSupportedTlsVersion = "1.2",
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "South Central US",
"etag": "3b76ce3d-892c-4036-9d8b-8ade18ba7a4b",
"tags": null,
"properties": {
"clusterVersion": "3.6.1000.67",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json",
"kind": "Hadoop",
"componentVersion": {
"Hadoop": "2.7"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_a4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2020-01-10T08:36:39.153",
"quotaInfo": {
"coresUsed": 20
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard",
"minSupportedTlsVersion": "1.2"
}
}
Create Hadoop cluster with Azure Data Lake Storage Gen 2
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"tags": {
"key1": "val1"
},
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "Hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": "true",
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.dfs.core.windows.net",
"isDefault": true,
"fileSystem": "default",
"key": "storagekey"
}
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"minInstanceCount": 1,
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "workernode",
"minInstanceCount": 1,
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "zookeepernode",
"minInstanceCount": 1,
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Small"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopAdlsGen2.json
*/
/**
* Sample code: Create Hadoop cluster with Azure Data Lake Storage Gen 2.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createHadoopClusterWithAzureDataLakeStorageGen2(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withTags(mapOf("key1", "val1"))
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":\"true\",\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withMinInstanceCount(1)
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("workernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(4)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("zookeepernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Small"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.dfs.core.windows.net")
.withIsDefault(true)
.withFileSystem("default")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_linux_hadoop_adls_gen2.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": "true",
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Hadoop",
},
"clusterVersion": "3.6",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 4,
},
{
"hardwareProfile": {"vmSize": "Small"},
"minInstanceCount": 1,
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
]
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"fileSystem": "default",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.dfs.core.windows.net",
}
]
},
"tier": "Standard",
},
"tags": {"key1": "val1"},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopAdlsGen2.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopAdlsGen2.json
func ExampleClustersClient_BeginCreate_createHadoopClusterWithAzureDataLakeStorageGen2() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": "true",
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](4),
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Small"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.dfs.core.windows.net"),
FileSystem: to.Ptr("default"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
Tags: map[string]*string{
"key1": to.Ptr("val1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("East US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("3.1"),
// },
// Kind: to.Ptr("HADOOP"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("4.0.1000.1"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d12_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](4),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2019-11-18T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](40),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopAdlsGen2.json
*/
async function createHadoopClusterWithAzureDataLakeStorageGen2() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": "true",
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Hadoop",
},
clusterVersion: "3.6",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 4,
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Small" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
],
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.dfs.core.windows.net",
fileSystem: "default",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
tags: { key1: "val1" },
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopAdlsGen2.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Tags =
{
["key1"] = "val1",
},
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
MinInstanceCount = 1,
TargetInstanceCount = 2,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "workernode",
MinInstanceCount = 1,
TargetInstanceCount = 4,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
MinInstanceCount = 1,
TargetInstanceCount = 3,
HardwareVmSize = "Small",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.dfs.core.windows.net",
IsDefault = true,
FileSystem = "default",
Key = "storagekey",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "East US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"properties": {
"clusterVersion": "4.0.1000.1",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json",
"kind": "HADOOP",
"componentVersion": {
"Hadoop": "3.1"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d12_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "standard_d4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2019-11-18T12:25:43.48",
"quotaInfo": {
"coresUsed": 40
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard"
}
}
Create Hadoop on Linux cluster with SSH password
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"tags": {
"key1": "val1"
},
"properties": {
"clusterVersion": "3.5",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "Hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": "true",
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "containername",
"key": "storagekey"
}
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"minInstanceCount": 1,
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "workernode",
"minInstanceCount": 1,
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "zookeepernode",
"minInstanceCount": 1,
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Small"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPassword.json
*/
/**
* Sample code: Create Hadoop on Linux cluster with SSH password.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createHadoopOnLinuxClusterWithSSHPassword(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withTags(mapOf("key1", "val1"))
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.5")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":\"true\",\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withMinInstanceCount(1)
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("workernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(4)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("zookeepernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Small"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_linux_hadoop_ssh_password.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": "true",
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Hadoop",
},
"clusterVersion": "3.5",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 4,
},
{
"hardwareProfile": {"vmSize": "Small"},
"minInstanceCount": 1,
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
]
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
},
"tags": {"key1": "val1"},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPassword.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPassword.json
func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPassword() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": "true",
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Hadoop"),
},
ClusterVersion: to.Ptr("3.5"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](4),
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Small"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
Tags: map[string]*string{
"key1": to.Ptr("val1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("East US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("3.1"),
// },
// Kind: to.Ptr("HADOOP"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("4.0.1000.1"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d12_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](4),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2019-11-18T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](40),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPassword.json
*/
async function createHadoopOnLinuxClusterWithSshPassword() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": "true",
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Hadoop",
},
clusterVersion: "3.5",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 4,
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Small" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
],
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "containername",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
tags: { key1: "val1" },
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPassword.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Tags =
{
["key1"] = "val1",
},
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.5",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
MinInstanceCount = 1,
TargetInstanceCount = 2,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "workernode",
MinInstanceCount = 1,
TargetInstanceCount = 4,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
MinInstanceCount = 1,
TargetInstanceCount = 3,
HardwareVmSize = "Small",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "containername",
Key = "storagekey",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "East US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"properties": {
"clusterVersion": "4.0.1000.1",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json",
"kind": "HADOOP",
"componentVersion": {
"Hadoop": "3.1"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d12_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "standard_d4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2019-11-18T12:25:43.48",
"quotaInfo": {
"coresUsed": 40
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard"
}
}
Create Hadoop on Linux cluster with SSH public key
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"tags": {
"key1": "val1"
},
"properties": {
"clusterVersion": "3.5",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "Hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "containername",
"key": "storagekey"
}
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"minInstanceCount": 1,
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
}
},
{
"name": "workernode",
"minInstanceCount": 1,
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "zookeepernode",
"minInstanceCount": 1,
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Small"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.SshProfile;
import com.azure.resourcemanager.hdinsight.models.SshPublicKey;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPublicKey.json
*/
/**
* Sample code: Create Hadoop on Linux cluster with SSH public key.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createHadoopOnLinuxClusterWithSSHPublicKey(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withTags(mapOf("key1", "val1"))
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.5")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withMinInstanceCount(1)
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********")))))),
new Role()
.withName("workernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(4)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("zookeepernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Small"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_linux_hadoop_ssh_public_key.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Hadoop",
},
"clusterVersion": "3.5",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 4,
},
{
"hardwareProfile": {"vmSize": "Small"},
"minInstanceCount": 1,
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
]
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
},
"tags": {"key1": "val1"},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPublicKey.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPublicKey.json
func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPublicKey() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Hadoop"),
},
ClusterVersion: to.Ptr("3.5"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](4),
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Small"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
Tags: map[string]*string{
"key1": to.Ptr("val1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("East US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("3.1"),
// },
// Kind: to.Ptr("HADOOP"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("4.0.1000.1"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d12_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](4),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2019-11-18T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](40),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPublicKey.json
*/
async function createHadoopOnLinuxClusterWithSshPublicKey() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Hadoop",
},
clusterVersion: "3.5",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 4,
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Small" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
],
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "containername",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
tags: { key1: "val1" },
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSshPublicKey.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Tags =
{
["key1"] = "val1",
},
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.5",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
MinInstanceCount = 1,
TargetInstanceCount = 2,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
},new HDInsightClusterRole()
{
Name = "workernode",
MinInstanceCount = 1,
TargetInstanceCount = 4,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
MinInstanceCount = 1,
TargetInstanceCount = 3,
HardwareVmSize = "Small",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "containername",
Key = "storagekey",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "East US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"properties": {
"clusterVersion": "4.0.1000.1",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json",
"kind": "HADOOP",
"componentVersion": {
"Hadoop": "3.1"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d12_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "standard_d4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2019-11-18T12:25:43.48",
"quotaInfo": {
"coresUsed": 40
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard"
}
}
Create HDInsight cluster with Autoscale configuration
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"properties": {
"clusterVersion": "3.6",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "hadoop",
"componentVersion": {
"Hadoop": "2.7"
},
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "hdinsight-autoscale-tes-2019-06-18t05-49-16-591z",
"key": "storagekey"
}
]
},
"computeProfile": {
"roles": [
{
"autoscale": {
"capacity": null,
"recurrence": {
"timeZone": "China Standard Time",
"schedule": [
{
"days": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"timeAndCapacity": {
"time": "09:00",
"minInstanceCount": 3,
"maxInstanceCount": 3
}
},
{
"days": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"timeAndCapacity": {
"time": "18:00",
"minInstanceCount": 6,
"maxInstanceCount": 6
}
},
{
"days": [
"Saturday",
"Sunday"
],
"timeAndCapacity": {
"time": "09:00",
"minInstanceCount": 2,
"maxInstanceCount": 2
}
},
{
"days": [
"Saturday",
"Sunday"
],
"timeAndCapacity": {
"time": "18:00",
"minInstanceCount": 4,
"maxInstanceCount": 4
}
}
]
}
},
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "Standard_D4_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
},
"virtualNetworkProfile": null,
"scriptActions": [],
"dataDisksGroups": null
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.Autoscale;
import com.azure.resourcemanager.hdinsight.models.AutoscaleRecurrence;
import com.azure.resourcemanager.hdinsight.models.AutoscaleSchedule;
import com.azure.resourcemanager.hdinsight.models.AutoscaleTimeAndCapacity;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.DaysOfWeek;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAutoscaleConfig.json
*/
/**
* Sample code: Create HDInsight cluster with Autoscale configuration.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createHDInsightClusterWithAutoscaleConfiguration(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.6")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("hadoop")
.withComponentVersion(mapOf("Hadoop", "2.7"))
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("workernode")
.withTargetInstanceCount(4)
.withAutoscaleConfiguration(
new Autoscale()
.withRecurrence(
new AutoscaleRecurrence()
.withTimeZone("China Standard Time")
.withSchedule(
Arrays
.asList(
new AutoscaleSchedule()
.withDays(
Arrays
.asList(
DaysOfWeek.MONDAY,
DaysOfWeek.TUESDAY,
DaysOfWeek.WEDNESDAY,
DaysOfWeek.THURSDAY,
DaysOfWeek.FRIDAY))
.withTimeAndCapacity(
new AutoscaleTimeAndCapacity()
.withTime("09:00")
.withMinInstanceCount(3)
.withMaxInstanceCount(3)),
new AutoscaleSchedule()
.withDays(
Arrays
.asList(
DaysOfWeek.MONDAY,
DaysOfWeek.TUESDAY,
DaysOfWeek.WEDNESDAY,
DaysOfWeek.THURSDAY,
DaysOfWeek.FRIDAY))
.withTimeAndCapacity(
new AutoscaleTimeAndCapacity()
.withTime("18:00")
.withMinInstanceCount(6)
.withMaxInstanceCount(6)),
new AutoscaleSchedule()
.withDays(
Arrays
.asList(
DaysOfWeek.SATURDAY,
DaysOfWeek.SUNDAY))
.withTimeAndCapacity(
new AutoscaleTimeAndCapacity()
.withTime("09:00")
.withMinInstanceCount(2)
.withMaxInstanceCount(2)),
new AutoscaleSchedule()
.withDays(
Arrays
.asList(
DaysOfWeek.SATURDAY,
DaysOfWeek.SUNDAY))
.withTimeAndCapacity(
new AutoscaleTimeAndCapacity()
.withTime("18:00")
.withMinInstanceCount(4)
.withMaxInstanceCount(4))))))
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D4_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")))
.withScriptActions(Arrays.asList()))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("hdinsight-autoscale-tes-2019-06-18t05-49-16-591z")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_hd_insight_cluster_with_autoscale_config.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"componentVersion": {"Hadoop": "2.7"},
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "hadoop",
},
"clusterVersion": "3.6",
"computeProfile": {
"roles": [
{
"autoscale": {
"capacity": None,
"recurrence": {
"schedule": [
{
"days": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
"timeAndCapacity": {
"maxInstanceCount": 3,
"minInstanceCount": 3,
"time": "09:00",
},
},
{
"days": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
"timeAndCapacity": {
"maxInstanceCount": 6,
"minInstanceCount": 6,
"time": "18:00",
},
},
{
"days": ["Saturday", "Sunday"],
"timeAndCapacity": {
"maxInstanceCount": 2,
"minInstanceCount": 2,
"time": "09:00",
},
},
{
"days": ["Saturday", "Sunday"],
"timeAndCapacity": {
"maxInstanceCount": 4,
"minInstanceCount": 4,
"time": "18:00",
},
},
],
"timeZone": "China Standard Time",
},
},
"dataDisksGroups": None,
"hardwareProfile": {"vmSize": "Standard_D4_V2"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"scriptActions": [],
"targetInstanceCount": 4,
"virtualNetworkProfile": None,
}
]
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "hdinsight-autoscale-tes-2019-06-18t05-49-16-591z",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAutoscaleConfig.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAutoscaleConfig.json
func ExampleClustersClient_BeginCreate_createHdInsightClusterWithAutoscaleConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
ComponentVersion: map[string]*string{
"Hadoop": to.Ptr("2.7"),
},
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("hadoop"),
},
ClusterVersion: to.Ptr("3.6"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("workernode"),
AutoscaleConfiguration: &armhdinsight.Autoscale{
Recurrence: &armhdinsight.AutoscaleRecurrence{
Schedule: []*armhdinsight.AutoscaleSchedule{
{
Days: []*armhdinsight.DaysOfWeek{
to.Ptr(armhdinsight.DaysOfWeekMonday),
to.Ptr(armhdinsight.DaysOfWeekTuesday),
to.Ptr(armhdinsight.DaysOfWeekWednesday),
to.Ptr(armhdinsight.DaysOfWeekThursday),
to.Ptr(armhdinsight.DaysOfWeekFriday)},
TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{
MaxInstanceCount: to.Ptr[int32](3),
MinInstanceCount: to.Ptr[int32](3),
Time: to.Ptr("09:00"),
},
},
{
Days: []*armhdinsight.DaysOfWeek{
to.Ptr(armhdinsight.DaysOfWeekMonday),
to.Ptr(armhdinsight.DaysOfWeekTuesday),
to.Ptr(armhdinsight.DaysOfWeekWednesday),
to.Ptr(armhdinsight.DaysOfWeekThursday),
to.Ptr(armhdinsight.DaysOfWeekFriday)},
TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{
MaxInstanceCount: to.Ptr[int32](6),
MinInstanceCount: to.Ptr[int32](6),
Time: to.Ptr("18:00"),
},
},
{
Days: []*armhdinsight.DaysOfWeek{
to.Ptr(armhdinsight.DaysOfWeekSaturday),
to.Ptr(armhdinsight.DaysOfWeekSunday)},
TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{
MaxInstanceCount: to.Ptr[int32](2),
MinInstanceCount: to.Ptr[int32](2),
Time: to.Ptr("09:00"),
},
},
{
Days: []*armhdinsight.DaysOfWeek{
to.Ptr(armhdinsight.DaysOfWeekSaturday),
to.Ptr(armhdinsight.DaysOfWeekSunday)},
TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{
MaxInstanceCount: to.Ptr[int32](4),
MinInstanceCount: to.Ptr[int32](4),
Time: to.Ptr("18:00"),
},
}},
TimeZone: to.Ptr("China Standard Time"),
},
},
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D4_V2"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
ScriptActions: []*armhdinsight.ScriptAction{},
TargetInstanceCount: to.Ptr[int32](4),
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("hdinsight-autoscale-tes-2019-06-18t05-49-16-591z"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("East US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("3.1"),
// },
// Kind: to.Ptr("HADOOP"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("4.0.1000.1"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d12_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](4),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2019-11-18T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](40),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAutoscaleConfig.json
*/
async function createHdInsightClusterWithAutoscaleConfiguration() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
componentVersion: { hadoop: "2.7" },
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "hadoop",
},
clusterVersion: "3.6",
computeProfile: {
roles: [
{
name: "workernode",
autoscaleConfiguration: {
capacity: {},
recurrence: {
schedule: [
{
days: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
timeAndCapacity: {
maxInstanceCount: 3,
minInstanceCount: 3,
time: "09:00",
},
},
{
days: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
timeAndCapacity: {
maxInstanceCount: 6,
minInstanceCount: 6,
time: "18:00",
},
},
{
days: ["Saturday", "Sunday"],
timeAndCapacity: {
maxInstanceCount: 2,
minInstanceCount: 2,
time: "09:00",
},
},
{
days: ["Saturday", "Sunday"],
timeAndCapacity: {
maxInstanceCount: 4,
minInstanceCount: 4,
time: "18:00",
},
},
],
timeZone: "China Standard Time",
},
},
dataDisksGroups: [],
hardwareProfile: { vmSize: "Standard_D4_V2" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
scriptActions: [],
targetInstanceCount: 4,
virtualNetworkProfile: {},
},
],
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "hdinsight-autoscale-tes-2019-06-18t05-49-16-591z",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateHDInsightClusterWithAutoscaleConfig.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.6",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "hadoop",
ComponentVersion =
{
["Hadoop"] = "2.7",
},
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 4,
AutoScaleConfiguration = new HDInsightAutoScaleConfiguration()
{
Capacity = null,
Recurrence = new HDInsightAutoScaleRecurrence()
{
TimeZone = "China Standard Time",
Schedule =
{
new HDInsightAutoScaleSchedule()
{
Days =
{
HDInsightDayOfWeek.Monday,HDInsightDayOfWeek.Tuesday,HDInsightDayOfWeek.Wednesday,HDInsightDayOfWeek.Thursday,HDInsightDayOfWeek.Friday
},
TimeAndCapacity = new HDInsightAutoScaleTimeAndCapacity()
{
Time = "09:00",
MinInstanceCount = 3,
MaxInstanceCount = 3,
},
},new HDInsightAutoScaleSchedule()
{
Days =
{
HDInsightDayOfWeek.Monday,HDInsightDayOfWeek.Tuesday,HDInsightDayOfWeek.Wednesday,HDInsightDayOfWeek.Thursday,HDInsightDayOfWeek.Friday
},
TimeAndCapacity = new HDInsightAutoScaleTimeAndCapacity()
{
Time = "18:00",
MinInstanceCount = 6,
MaxInstanceCount = 6,
},
},new HDInsightAutoScaleSchedule()
{
Days =
{
HDInsightDayOfWeek.Saturday,HDInsightDayOfWeek.Sunday
},
TimeAndCapacity = new HDInsightAutoScaleTimeAndCapacity()
{
Time = "09:00",
MinInstanceCount = 2,
MaxInstanceCount = 2,
},
},new HDInsightAutoScaleSchedule()
{
Days =
{
HDInsightDayOfWeek.Saturday,HDInsightDayOfWeek.Sunday
},
TimeAndCapacity = new HDInsightAutoScaleTimeAndCapacity()
{
Time = "18:00",
MinInstanceCount = 4,
MaxInstanceCount = 4,
},
}
},
},
},
HardwareVmSize = "Standard_D4_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
VirtualNetworkProfile = null,
DataDisksGroups =
{
},
ScriptActions =
{
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "hdinsight-autoscale-tes-2019-06-18t05-49-16-591z",
Key = "storagekey",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "East US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"properties": {
"clusterVersion": "4.0.1000.1",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json",
"kind": "HADOOP",
"componentVersion": {
"Hadoop": "3.1"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d12_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "standard_d4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2019-11-18T12:25:43.48",
"quotaInfo": {
"coresUsed": 40
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard"
}
}
Create Kafka cluster with Kafka Rest Proxy
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"properties": {
"clusterVersion": "4.0",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "kafka",
"componentVersion": {
"Kafka": "2.1"
},
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"kafkaRestProperties": {
"clientGroupInfo": {
"groupName": "Kafka security group name",
"groupId": "00000000-0000-0000-0000-111111111111"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Large"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Large"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
},
"dataDisksGroups": [
{
"disksPerNode": 8
}
]
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Small"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "kafkamanagementnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Standard_D4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "kafkauser",
"password": "**********"
}
}
}
]
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "containername",
"key": "storagekey"
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClientGroupInfo;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.DataDisksGroups;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.KafkaRestProperties;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateKafkaClusterWithKafkaRestProxy.json
*/
/**
* Sample code: Create Kafka cluster with Kafka Rest Proxy.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createKafkaClusterWithKafkaRestProxy(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("4.0")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("kafka")
.withComponentVersion(mapOf("Kafka", "2.1"))
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withKafkaRestProperties(
new KafkaRestProperties()
.withClientGroupInfo(
new ClientGroupInfo()
.withGroupName("Kafka security group name")
.withGroupId("00000000-0000-0000-0000-111111111111")))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Large"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("workernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Large"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")))
.withDataDisksGroups(
Arrays.asList(new DataDisksGroups().withDisksPerNode(8))),
new Role()
.withName("zookeepernode")
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Small"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("kafkamanagementnode")
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D4_v2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("kafkauser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_kafka_cluster_with_kafka_rest_proxy.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"componentVersion": {"Kafka": "2.1"},
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "kafka",
},
"clusterVersion": "4.0",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Large"},
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 2,
},
{
"dataDisksGroups": [{"disksPerNode": 8}],
"hardwareProfile": {"vmSize": "Large"},
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
{
"hardwareProfile": {"vmSize": "Small"},
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 3,
},
{
"hardwareProfile": {"vmSize": "Standard_D4_v2"},
"name": "kafkamanagementnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "kafkauser"}
},
"targetInstanceCount": 2,
},
]
},
"kafkaRestProperties": {
"clientGroupInfo": {
"groupId": "00000000-0000-0000-0000-111111111111",
"groupName": "Kafka security group name",
}
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storagekey",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
}
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateKafkaClusterWithKafkaRestProxy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateKafkaClusterWithKafkaRestProxy.json
func ExampleClustersClient_BeginCreate_createKafkaClusterWithKafkaRestProxy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
ComponentVersion: map[string]*string{
"Kafka": to.Ptr("2.1"),
},
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("kafka"),
},
ClusterVersion: to.Ptr("4.0"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Large"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
DataDisksGroups: []*armhdinsight.DataDisksGroups{
{
DisksPerNode: to.Ptr[int32](8),
}},
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Large"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Small"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](3),
},
{
Name: to.Ptr("kafkamanagementnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D4_v2"),
},
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("kafkauser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
}},
},
KafkaRestProperties: &armhdinsight.KafkaRestProperties{
ClientGroupInfo: &armhdinsight.ClientGroupInfo{
GroupID: to.Ptr("00000000-0000-0000-0000-111111111111"),
GroupName: to.Ptr("Kafka security group name"),
},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storagekey"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("South Central US"),
// Etag: to.Ptr("e1266b83-9bda-4797-a906-1bf82c8eb09a"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/kafka-4.0.1000.1.1911212244.json"),
// ComponentVersion: map[string]*string{
// "Kafka": to.Ptr("2.1"),
// },
// Kind: to.Ptr("KAFKA"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("4.0.1000.1"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// DataDisksGroups: []*armhdinsight.DataDisksGroups{
// {
// DiskSizeGB: to.Ptr[int32](1023),
// DisksPerNode: to.Ptr[int32](2),
// StorageAccountType: to.Ptr("Standard_LRS"),
// }},
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d3_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](4),
// },
// {
// Name: to.Ptr("kafkamanagementnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("KafkaRestProxyPublicEndpoint"),
// Location: to.Ptr("cluster1-kafkarest.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2019-11-25T03:43:23.663"),
// KafkaRestProperties: &armhdinsight.KafkaRestProperties{
// ClientGroupInfo: &armhdinsight.ClientGroupInfo{
// GroupID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// GroupName: to.Ptr("security group name"),
// },
// },
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](52),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateKafkaClusterWithKafkaRestProxy.json
*/
async function createKafkaClusterWithKafkaRestProxy() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
componentVersion: { kafka: "2.1" },
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "kafka",
},
clusterVersion: "4.0",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Large" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
dataDisksGroups: [{ disksPerNode: 8 }],
hardwareProfile: { vmSize: "Large" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Small" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 3,
},
{
name: "kafkamanagementnode",
hardwareProfile: { vmSize: "Standard_D4_v2" },
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "kafkauser",
},
},
targetInstanceCount: 2,
},
],
},
kafkaRestProperties: {
clientGroupInfo: {
groupId: "00000000-0000-0000-0000-111111111111",
groupName: "Kafka security group name",
},
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "containername",
isDefault: true,
key: "storagekey",
},
],
},
tier: "Standard",
},
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateKafkaClusterWithKafkaRestProxy.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "4.0",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "kafka",
ComponentVersion =
{
["Kafka"] = "2.1",
},
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
KafkaRestProperties = new KafkaRestProperties()
{
ClientGroupInfo = new ClientGroupInfo()
{
GroupName = "Kafka security group name",
GroupId = "00000000-0000-0000-0000-111111111111",
},
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
TargetInstanceCount = 2,
HardwareVmSize = "Large",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "workernode",
TargetInstanceCount = 3,
HardwareVmSize = "Large",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
DataDisksGroups =
{
new HDInsightClusterDataDiskGroup()
{
DisksPerNode = 8,
}
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
TargetInstanceCount = 3,
HardwareVmSize = "Small",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "kafkamanagementnode",
TargetInstanceCount = 2,
HardwareVmSize = "Standard_D4_v2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "kafkauser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "containername",
Key = "storagekey",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "South Central US",
"etag": "e1266b83-9bda-4797-a906-1bf82c8eb09a",
"tags": null,
"properties": {
"clusterVersion": "4.0.1000.1",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/kafka-4.0.1000.1.1911212244.json",
"kind": "KAFKA",
"componentVersion": {
"Kafka": "2.1"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d3_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "standard_d3_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
},
"dataDisksGroups": [
{
"disksPerNode": 2,
"storageAccountType": "Standard_LRS",
"diskSizeGB": 1023
}
]
},
{
"name": "kafkamanagementnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2019-11-25T03:43:23.663",
"quotaInfo": {
"coresUsed": 52
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
},
{
"name": "KafkaRestProxyPublicEndpoint",
"protocol": "TCP",
"location": "cluster1-kafkarest.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard",
"kafkaRestProperties": {
"clientGroupInfo": {
"groupName": "security group name",
"groupId": "00000000-0000-0000-0000-000000000000"
}
}
}
}
Create Secure Hadoop cluster
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"tags": {
"key1": "val1"
},
"properties": {
"clusterVersion": "3.5",
"osType": "Linux",
"tier": "Premium",
"clusterDefinition": {
"kind": "Hadoop",
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "containername",
"key": "storage account key"
}
]
},
"securityProfile": {
"directoryType": "ActiveDirectory",
"domain": "DomainName",
"organizationalUnitDN": "OU=Hadoop,DC=hdinsight,DC=test",
"ldapsUrls": [
"ldaps://10.10.0.4:636"
],
"domainUsername": "DomainUsername",
"domainUserPassword": "**********",
"clusterUsersGroupDNs": [
"hdiusers"
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"minInstanceCount": 1,
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
},
"scriptActions": []
},
{
"name": "workernode",
"minInstanceCount": 1,
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "Standard_D3_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
},
"scriptActions": []
},
{
"name": "zookeepernode",
"minInstanceCount": 1,
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "Small"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********",
"sshProfile": {
"publicKeys": [
{
"certificateData": "**********"
}
]
}
}
},
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"
},
"scriptActions": []
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.DirectoryType;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.SecurityProfile;
import com.azure.resourcemanager.hdinsight.models.SshProfile;
import com.azure.resourcemanager.hdinsight.models.SshPublicKey;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import com.azure.resourcemanager.hdinsight.models.VirtualNetworkProfile;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSecureHadoop.json
*/
/**
* Sample code: Create Secure Hadoop cluster.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createSecureHadoopCluster(com.azure.resourcemanager.hdinsight.HDInsightManager manager)
throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withTags(mapOf("key1", "val1"))
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.5")
.withOsType(OSType.LINUX)
.withTier(Tier.PREMIUM)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Hadoop")
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withSecurityProfile(
new SecurityProfile()
.withDirectoryType(DirectoryType.ACTIVE_DIRECTORY)
.withDomain("DomainName")
.withOrganizationalUnitDN("OU=Hadoop,DC=hdinsight,DC=test")
.withLdapsUrls(Arrays.asList("ldaps://10.10.0.4:636"))
.withDomainUsername("DomainUsername")
.withDomainUserPassword("fakeTokenPlaceholder")
.withClusterUsersGroupDNs(Arrays.asList("hdiusers")))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withMinInstanceCount(1)
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********"))))))
.withVirtualNetworkProfile(
new VirtualNetworkProfile()
.withId(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname")
.withSubnet(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"))
.withScriptActions(Arrays.asList()),
new Role()
.withName("workernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(4)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D3_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********"))))))
.withVirtualNetworkProfile(
new VirtualNetworkProfile()
.withId(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname")
.withSubnet(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"))
.withScriptActions(Arrays.asList()),
new Role()
.withName("zookeepernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(3)
.withHardwareProfile(new HardwareProfile().withVmSize("Small"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder")
.withSshProfile(
new SshProfile()
.withPublicKeys(
Arrays
.asList(
new SshPublicKey()
.withCertificateData(
"**********"))))))
.withVirtualNetworkProfile(
new VirtualNetworkProfile()
.withId(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname")
.withSubnet(
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"))
.withScriptActions(Arrays.asList()))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_linux_hadoop_secure_hadoop.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Hadoop",
},
"clusterVersion": "3.5",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"scriptActions": [],
"targetInstanceCount": 2,
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
"hardwareProfile": {"vmSize": "Standard_D3_V2"},
"minInstanceCount": 1,
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"scriptActions": [],
"targetInstanceCount": 4,
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
"hardwareProfile": {"vmSize": "Small"},
"minInstanceCount": 1,
"name": "zookeepernode",
"osProfile": {
"linuxOperatingSystemProfile": {
"password": "**********",
"sshProfile": {"publicKeys": [{"certificateData": "**********"}]},
"username": "sshuser",
}
},
"scriptActions": [],
"targetInstanceCount": 3,
"virtualNetworkProfile": {
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
"subnet": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
]
},
"osType": "Linux",
"securityProfile": {
"clusterUsersGroupDNs": ["hdiusers"],
"directoryType": "ActiveDirectory",
"domain": "DomainName",
"domainUserPassword": "**********",
"domainUsername": "DomainUsername",
"ldapsUrls": ["ldaps://10.10.0.4:636"],
"organizationalUnitDN": "OU=Hadoop,DC=hdinsight,DC=test",
},
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storage account key",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Premium",
},
"tags": {"key1": "val1"},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSecureHadoop.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSecureHadoop.json
func ExampleClustersClient_BeginCreate_createSecureHadoopCluster() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Hadoop"),
},
ClusterVersion: to.Ptr("3.5"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
ScriptActions: []*armhdinsight.ScriptAction{},
TargetInstanceCount: to.Ptr[int32](2),
VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
},
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D3_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
ScriptActions: []*armhdinsight.ScriptAction{},
TargetInstanceCount: to.Ptr[int32](4),
VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
},
},
{
Name: to.Ptr("zookeepernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Small"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
SSHProfile: &armhdinsight.SSHProfile{
PublicKeys: []*armhdinsight.SSHPublicKey{
{
CertificateData: to.Ptr("**********"),
}},
},
Username: to.Ptr("sshuser"),
},
},
ScriptActions: []*armhdinsight.ScriptAction{},
TargetInstanceCount: to.Ptr[int32](3),
VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{
ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"),
},
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
SecurityProfile: &armhdinsight.SecurityProfile{
ClusterUsersGroupDNs: []*string{
to.Ptr("hdiusers")},
DirectoryType: to.Ptr(armhdinsight.DirectoryTypeActiveDirectory),
Domain: to.Ptr("DomainName"),
DomainUserPassword: to.Ptr("**********"),
DomainUsername: to.Ptr("DomainUsername"),
LdapsUrls: []*string{
to.Ptr("ldaps://10.10.0.4:636")},
OrganizationalUnitDN: to.Ptr("OU=Hadoop,DC=hdinsight,DC=test"),
},
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storage account key"),
}},
},
Tier: to.Ptr(armhdinsight.TierPremium),
},
Tags: map[string]*string{
"key1": to.Ptr("val1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("East US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("3.1"),
// },
// Kind: to.Ptr("HADOOP"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("4.0.1000.1"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d12_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](4),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2019-11-18T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](40),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSecureHadoop.json
*/
async function createSecureHadoopCluster() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Hadoop",
},
clusterVersion: "3.5",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
scriptActions: [],
targetInstanceCount: 2,
virtualNetworkProfile: {
id: "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
subnet:
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
name: "workernode",
hardwareProfile: { vmSize: "Standard_D3_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
scriptActions: [],
targetInstanceCount: 4,
virtualNetworkProfile: {
id: "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
subnet:
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
{
name: "zookeepernode",
hardwareProfile: { vmSize: "Small" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
sshProfile: { publicKeys: [{ certificateData: "**********" }] },
username: "sshuser",
},
},
scriptActions: [],
targetInstanceCount: 3,
virtualNetworkProfile: {
id: "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname",
subnet:
"/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
},
],
},
osType: "Linux",
securityProfile: {
clusterUsersGroupDNs: ["hdiusers"],
directoryType: "ActiveDirectory",
domain: "DomainName",
domainUserPassword: "**********",
domainUsername: "DomainUsername",
ldapsUrls: ["ldaps://10.10.0.4:636"],
organizationalUnitDN: "OU=Hadoop,DC=hdinsight,DC=test",
},
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "containername",
isDefault: true,
key: "storage account key",
},
],
},
tier: "Premium",
},
tags: { key1: "val1" },
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxHadoopSecureHadoop.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Tags =
{
["key1"] = "val1",
},
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.5",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Premium,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Hadoop",
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
SecurityProfile = new HDInsightSecurityProfile()
{
DirectoryType = AuthenticationDirectoryType.ActiveDirectory,
Domain = "DomainName",
OrganizationalUnitDN = "OU=Hadoop,DC=hdinsight,DC=test",
LdapUris =
{
new Uri("ldaps://10.10.0.4:636")
},
DomainUsername = "DomainUsername",
DomainUserPassword = "**********",
ClusterUsersGroupDNs =
{
"hdiusers"
},
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
MinInstanceCount = 1,
TargetInstanceCount = 2,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
VirtualNetworkProfile = new HDInsightVirtualNetworkProfile()
{
Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet = "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
ScriptActions =
{
},
},new HDInsightClusterRole()
{
Name = "workernode",
MinInstanceCount = 1,
TargetInstanceCount = 4,
HardwareVmSize = "Standard_D3_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
VirtualNetworkProfile = new HDInsightVirtualNetworkProfile()
{
Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet = "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
ScriptActions =
{
},
},new HDInsightClusterRole()
{
Name = "zookeepernode",
MinInstanceCount = 1,
TargetInstanceCount = 3,
HardwareVmSize = "Small",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
SshPublicKeys =
{
new HDInsightSshPublicKey()
{
CertificateData = "**********",
}
},
},
VirtualNetworkProfile = new HDInsightVirtualNetworkProfile()
{
Id = new ResourceIdentifier("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"),
Subnet = "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet",
},
ScriptActions =
{
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "containername",
Key = "storage account key",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "East US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"properties": {
"clusterVersion": "4.0.1000.1",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json",
"kind": "HADOOP",
"componentVersion": {
"Hadoop": "3.1"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d12_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "standard_d4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2019-11-18T12:25:43.48",
"quotaInfo": {
"coresUsed": 40
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard"
}
}
Create Spark on Linux Cluster with SSH password
Beispielanforderung
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1?api-version=2021-06-01
{
"tags": {
"key1": "val1"
},
"properties": {
"clusterVersion": "3.5",
"osType": "Linux",
"tier": "Standard",
"clusterDefinition": {
"kind": "Spark",
"componentVersion": {
"Spark": "2.0"
},
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": true,
"restAuthCredential.username": "admin",
"restAuthCredential.password": "**********"
}
}
},
"storageProfile": {
"storageaccounts": [
{
"name": "mystorage.blob.core.windows.net",
"isDefault": true,
"container": "containername",
"key": "storageapikey*"
}
]
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"minInstanceCount": 1,
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "Standard_D12_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
},
{
"name": "workernode",
"minInstanceCount": 1,
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "Standard_D4_V2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser",
"password": "**********"
}
}
}
]
}
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.hdinsight.models.ClusterCreateProperties;
import com.azure.resourcemanager.hdinsight.models.ClusterDefinition;
import com.azure.resourcemanager.hdinsight.models.ComputeProfile;
import com.azure.resourcemanager.hdinsight.models.HardwareProfile;
import com.azure.resourcemanager.hdinsight.models.LinuxOperatingSystemProfile;
import com.azure.resourcemanager.hdinsight.models.OSType;
import com.azure.resourcemanager.hdinsight.models.OsProfile;
import com.azure.resourcemanager.hdinsight.models.Role;
import com.azure.resourcemanager.hdinsight.models.StorageAccount;
import com.azure.resourcemanager.hdinsight.models.StorageProfile;
import com.azure.resourcemanager.hdinsight.models.Tier;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/** Samples for Clusters Create. */
public final class Main {
/*
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxSparkSshPassword.json
*/
/**
* Sample code: Create Spark on Linux Cluster with SSH password.
*
* @param manager Entry point to HDInsightManager.
*/
public static void createSparkOnLinuxClusterWithSSHPassword(
com.azure.resourcemanager.hdinsight.HDInsightManager manager) throws IOException {
manager
.clusters()
.define("cluster1")
.withExistingResourceGroup("rg1")
.withTags(mapOf("key1", "val1"))
.withProperties(
new ClusterCreateProperties()
.withClusterVersion("3.5")
.withOsType(OSType.LINUX)
.withTier(Tier.STANDARD)
.withClusterDefinition(
new ClusterDefinition()
.withKind("Spark")
.withComponentVersion(mapOf("Spark", "2.0"))
.withConfigurations(
SerializerFactory
.createDefaultManagementSerializerAdapter()
.deserialize(
"{\"gateway\":{\"restAuthCredential.isEnabled\":true,\"restAuthCredential.password\":\"**********\",\"restAuthCredential.username\":\"admin\"}}",
Object.class,
SerializerEncoding.JSON)))
.withComputeProfile(
new ComputeProfile()
.withRoles(
Arrays
.asList(
new Role()
.withName("headnode")
.withMinInstanceCount(1)
.withTargetInstanceCount(2)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D12_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))),
new Role()
.withName("workernode")
.withMinInstanceCount(1)
.withTargetInstanceCount(4)
.withHardwareProfile(new HardwareProfile().withVmSize("Standard_D4_V2"))
.withOsProfile(
new OsProfile()
.withLinuxOperatingSystemProfile(
new LinuxOperatingSystemProfile()
.withUsername("sshuser")
.withPassword("fakeTokenPlaceholder"))))))
.withStorageProfile(
new StorageProfile()
.withStorageaccounts(
Arrays
.asList(
new StorageAccount()
.withName("mystorage.blob.core.windows.net")
.withIsDefault(true)
.withContainer("containername")
.withKey("fakeTokenPlaceholder")))))
.create();
}
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.hdinsight import HDInsightManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-hdinsight
# USAGE
python create_linux_spark_ssh_password.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = HDInsightManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.clusters.begin_create(
resource_group_name="rg1",
cluster_name="cluster1",
parameters={
"properties": {
"clusterDefinition": {
"componentVersion": {"Spark": "2.0"},
"configurations": {
"gateway": {
"restAuthCredential.isEnabled": True,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
}
},
"kind": "Spark",
},
"clusterVersion": "3.5",
"computeProfile": {
"roles": [
{
"hardwareProfile": {"vmSize": "Standard_D12_V2"},
"minInstanceCount": 1,
"name": "headnode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 2,
},
{
"hardwareProfile": {"vmSize": "Standard_D4_V2"},
"minInstanceCount": 1,
"name": "workernode",
"osProfile": {
"linuxOperatingSystemProfile": {"password": "**********", "username": "sshuser"}
},
"targetInstanceCount": 4,
},
]
},
"osType": "Linux",
"storageProfile": {
"storageaccounts": [
{
"container": "containername",
"isDefault": True,
"key": "storageapikey*",
"name": "mystorage.blob.core.windows.net",
}
]
},
"tier": "Standard",
},
"tags": {"key1": "val1"},
},
).result()
print(response)
# x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxSparkSshPassword.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armhdinsight_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxSparkSshPassword.json
func ExampleClustersClient_BeginCreate_createSparkOnLinuxClusterWithSshPassword() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armhdinsight.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{
Properties: &armhdinsight.ClusterCreateProperties{
ClusterDefinition: &armhdinsight.ClusterDefinition{
ComponentVersion: map[string]*string{
"Spark": to.Ptr("2.0"),
},
Configurations: map[string]any{
"gateway": map[string]any{
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
Kind: to.Ptr("Spark"),
},
ClusterVersion: to.Ptr("3.5"),
ComputeProfile: &armhdinsight.ComputeProfile{
Roles: []*armhdinsight.Role{
{
Name: to.Ptr("headnode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D12_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](2),
},
{
Name: to.Ptr("workernode"),
HardwareProfile: &armhdinsight.HardwareProfile{
VMSize: to.Ptr("Standard_D4_V2"),
},
MinInstanceCount: to.Ptr[int32](1),
OSProfile: &armhdinsight.OsProfile{
LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
Password: to.Ptr("**********"),
Username: to.Ptr("sshuser"),
},
},
TargetInstanceCount: to.Ptr[int32](4),
}},
},
OSType: to.Ptr(armhdinsight.OSTypeLinux),
StorageProfile: &armhdinsight.StorageProfile{
Storageaccounts: []*armhdinsight.StorageAccount{
{
Name: to.Ptr("mystorage.blob.core.windows.net"),
Container: to.Ptr("containername"),
IsDefault: to.Ptr(true),
Key: to.Ptr("storageapikey*"),
}},
},
Tier: to.Ptr(armhdinsight.TierStandard),
},
Tags: map[string]*string{
"key1": to.Ptr("val1"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Cluster = armhdinsight.Cluster{
// Name: to.Ptr("cluster1"),
// Type: to.Ptr("Microsoft.HDInsight/clusters"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"),
// Location: to.Ptr("East US"),
// Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"),
// Properties: &armhdinsight.ClusterGetProperties{
// ClusterDefinition: &armhdinsight.ClusterDefinition{
// Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"),
// ComponentVersion: map[string]*string{
// "Hadoop": to.Ptr("3.1"),
// },
// Kind: to.Ptr("SPARK"),
// },
// ClusterState: to.Ptr("Running"),
// ClusterVersion: to.Ptr("4.0.1000.1"),
// ComputeProfile: &armhdinsight.ComputeProfile{
// Roles: []*armhdinsight.Role{
// {
// Name: to.Ptr("headnode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d12_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](2),
// },
// {
// Name: to.Ptr("workernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_d4_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](4),
// },
// {
// Name: to.Ptr("zookeepernode"),
// HardwareProfile: &armhdinsight.HardwareProfile{
// VMSize: to.Ptr("standard_a2_v2"),
// },
// OSProfile: &armhdinsight.OsProfile{
// LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{
// Username: to.Ptr("sshuser"),
// },
// },
// TargetInstanceCount: to.Ptr[int32](3),
// }},
// },
// ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{
// {
// Name: to.Ptr("SSH"),
// Location: to.Ptr("cluster1-ssh.azurehdinsight.net"),
// Port: to.Ptr[int32](22),
// Protocol: to.Ptr("TCP"),
// },
// {
// Name: to.Ptr("HTTPS"),
// Location: to.Ptr("cluster1.azurehdinsight.net"),
// Port: to.Ptr[int32](443),
// Protocol: to.Ptr("TCP"),
// }},
// CreatedDate: to.Ptr("2019-11-18T12:25:43.48"),
// OSType: to.Ptr(armhdinsight.OSTypeLinux),
// ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded),
// QuotaInfo: &armhdinsight.QuotaInfo{
// CoresUsed: to.Ptr[int32](40),
// },
// Tier: to.Ptr(armhdinsight.TierStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { HDInsightManagementClient } = require("@azure/arm-hdinsight");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new HDInsight cluster with the specified parameters.
*
* @summary Creates a new HDInsight cluster with the specified parameters.
* x-ms-original-file: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxSparkSshPassword.json
*/
async function createSparkOnLinuxClusterWithSshPassword() {
const subscriptionId = process.env["HDINSIGHT_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["HDINSIGHT_RESOURCE_GROUP"] || "rg1";
const clusterName = "cluster1";
const parameters = {
properties: {
clusterDefinition: {
componentVersion: { spark: "2.0" },
configurations: {
gateway: {
"restAuthCredential.isEnabled": true,
"restAuthCredential.password": "**********",
"restAuthCredential.username": "admin",
},
},
kind: "Spark",
},
clusterVersion: "3.5",
computeProfile: {
roles: [
{
name: "headnode",
hardwareProfile: { vmSize: "Standard_D12_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 2,
},
{
name: "workernode",
hardwareProfile: { vmSize: "Standard_D4_V2" },
minInstanceCount: 1,
osProfile: {
linuxOperatingSystemProfile: {
password: "**********",
username: "sshuser",
},
},
targetInstanceCount: 4,
},
],
},
osType: "Linux",
storageProfile: {
storageaccounts: [
{
name: "mystorage.blob.core.windows.net",
container: "containername",
isDefault: true,
key: "storageapikey*",
},
],
},
tier: "Standard",
},
tags: { key1: "val1" },
};
const credential = new DefaultAzureCredential();
const client = new HDInsightManagementClient(credential, subscriptionId);
const result = await client.clusters.beginCreateAndWait(
resourceGroupName,
clusterName,
parameters
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.HDInsight;
using Azure.ResourceManager.HDInsight.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/hdinsight/resource-manager/Microsoft.HDInsight/stable/2021-06-01/examples/CreateLinuxSparkSshPassword.json
// this example is just showing the usage of "Clusters_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this HDInsightClusterResource
HDInsightClusterCollection collection = resourceGroupResource.GetHDInsightClusters();
// invoke the operation
string clusterName = "cluster1";
HDInsightClusterCreateOrUpdateContent content = new HDInsightClusterCreateOrUpdateContent()
{
Tags =
{
["key1"] = "val1",
},
Properties = new HDInsightClusterCreateOrUpdateProperties()
{
ClusterVersion = "3.5",
OSType = HDInsightOSType.Linux,
Tier = HDInsightTier.Standard,
ClusterDefinition = new HDInsightClusterDefinition()
{
Kind = "Spark",
ComponentVersion =
{
["Spark"] = "2.0",
},
Configurations = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["gateway"] = new Dictionary<string, object>()
{
["restAuthCredential.isEnabled"] = "true",
["restAuthCredential.password"] = "**********",
["restAuthCredential.username"] = "admin"
}
}),
},
ComputeRoles =
{
new HDInsightClusterRole()
{
Name = "headnode",
MinInstanceCount = 1,
TargetInstanceCount = 2,
HardwareVmSize = "Standard_D12_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
},new HDInsightClusterRole()
{
Name = "workernode",
MinInstanceCount = 1,
TargetInstanceCount = 4,
HardwareVmSize = "Standard_D4_V2",
OSLinuxProfile = new HDInsightLinuxOSProfile()
{
Username = "sshuser",
Password = "**********",
},
}
},
StorageAccounts =
{
new HDInsightStorageAccountInfo()
{
Name = "mystorage.blob.core.windows.net",
IsDefault = true,
Container = "containername",
Key = "storageapikey*",
}
},
},
};
ArmOperation<HDInsightClusterResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, clusterName, content);
HDInsightClusterResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
HDInsightClusterData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
location: https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/azureasyncoperations/create?api-version=2021-06-01
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1",
"name": "cluster1",
"type": "Microsoft.HDInsight/clusters",
"location": "East US",
"etag": "fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff",
"properties": {
"clusterVersion": "4.0.1000.1",
"osType": "Linux",
"clusterDefinition": {
"blueprint": "https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json",
"kind": "SPARK",
"componentVersion": {
"Hadoop": "3.1"
}
},
"computeProfile": {
"roles": [
{
"name": "headnode",
"targetInstanceCount": 2,
"hardwareProfile": {
"vmSize": "standard_d12_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "workernode",
"targetInstanceCount": 4,
"hardwareProfile": {
"vmSize": "standard_d4_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
},
{
"name": "zookeepernode",
"targetInstanceCount": 3,
"hardwareProfile": {
"vmSize": "standard_a2_v2"
},
"osProfile": {
"linuxOperatingSystemProfile": {
"username": "sshuser"
}
}
}
]
},
"provisioningState": "Succeeded",
"clusterState": "Running",
"createdDate": "2019-11-18T12:25:43.48",
"quotaInfo": {
"coresUsed": 40
},
"connectivityEndpoints": [
{
"name": "SSH",
"protocol": "TCP",
"location": "cluster1-ssh.azurehdinsight.net",
"port": 22
},
{
"name": "HTTPS",
"protocol": "TCP",
"location": "cluster1.azurehdinsight.net",
"port": 443
}
],
"tier": "Standard"
}
}
Definitionen
| Name |
Beschreibung |
|
Autoscale
|
Die Parameter für die AutoScale-Anforderung
|
|
AutoscaleCapacity
|
Die ladebasierten AutoScale-Anforderungsparameter
|
|
AutoscaleRecurrence
|
Zeitplanbasierte Autoskalenanforderungsparameter
|
|
AutoscaleSchedule
|
Parameter für eine zeitplanbasierte Autoskalenregel, bestehend aus einem Array von Tagen und einer Zeit und Kapazität
|
|
AutoscaleTimeAndCapacity
|
Zeit- und Kapazitätsanforderungsparameter
|
|
ClientGroupInfo
|
Die Informationen der AAD-Sicherheitsgruppe.
|
|
Cluster
|
Der HDInsight-Cluster.
|
|
ClusterCreateParametersExtended
|
Die CreateCluster-Anforderungsparameter.
|
|
ClusterCreateProperties
|
Der Cluster erstellt Parameter.
|
|
ClusterDefinition
|
Die Clusterdefinition.
|
|
ClusterGetProperties
|
Die Eigenschaften des Clusters.
|
|
ClusterIdentity
|
Identität für den Cluster.
|
|
ComputeIsolationProperties
|
Die Computeisolationseigenschaften.
|
|
ComputeProfile
|
Beschreibt das Computeprofil.
|
|
ConnectivityEndpoint
|
Die Verbindungseigenschaften
|
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
|
DataDisksGroups
|
Die Datenträgergruppen für die Rolle.
|
|
DaysOfWeek
|
Wochentage für eine zeitplanbasierte Autoskalenregel
|
|
DirectoryType
|
Der Verzeichnistyp.
|
|
DiskEncryptionProperties
|
Die Datenträgerverschlüsselungseigenschaften
|
|
EncryptionInTransitProperties
|
Die Verschlüsselungs-in-Transit-Eigenschaften.
|
|
ErrorResponse
|
Beschreibt das Format der Fehlerantwort.
|
|
Errors
|
Die Fehlermeldung, die der Clustererstellung zugeordnet ist.
|
|
ExcludedServicesConfig
|
Die Konfiguration, die dienste beim Erstellen des Clusters ausgeschlossen werden.
|
|
HardwareProfile
|
Das Hardwareprofil.
|
|
HDInsightClusterProvisioningState
|
Der Bereitstellungsstatus, der nur in der Antwort angezeigt wird.
|
|
IPConfiguration
|
Die IP-Konfigurationen für den privaten Linkdienst.
|
|
JsonWebKeyEncryptionAlgorithm
|
Algorithmusbezeichner für Verschlüsselung, Standard RSA-OAEP.
|
|
KafkaRestProperties
|
Die Kafka-Restproxykonfiguration, die AAD-Sicherheitsgruppeninformationen enthält.
|
|
LinuxOperatingSystemProfile
|
Der ssh-Benutzername, das Kennwort und der öffentliche SSH-Schlüssel.
|
|
NetworkProperties
|
Die Netzwerkeigenschaften.
|
|
OsProfile
|
Das Profil der Linux-Betriebssysteme.
|
|
OSType
|
Der Typ des Betriebssystems.
|
|
PrivateEndpoint
|
Der private Endpunkt.
|
|
PrivateEndpointConnection
|
Die private Endpunktverbindung.
|
|
PrivateEndpointConnectionProvisioningState
|
Der Bereitstellungsstatus, der nur in der Antwort angezeigt wird.
|
|
PrivateIPAllocationMethod
|
Die Methode, die private IP-Adresse zugewiesen wird.
|
|
PrivateLink
|
Gibt an, ob der private Link aktiviert ist.
|
|
PrivateLinkConfiguration
|
Die Konfiguration für private Verknüpfungen.
|
|
PrivateLinkConfigurationProvisioningState
|
Der Bereitstellungsstatus der Konfiguration für private Verknüpfungen, der nur in der Antwort angezeigt wird.
|
|
PrivateLinkServiceConnectionState
|
Der Verbindungsstatus des privaten Verknüpfungsdiensts.
|
|
PrivateLinkServiceConnectionStatus
|
Die konkrete Private Link Service-Verbindung.
|
|
QuotaInfo
|
Die Kontingenteigenschaften für den Cluster.
|
|
ResourceId
|
Die Azure-Ressourcen-ID.
|
|
ResourceIdentityType
|
Der Identitätstyp, der für den Cluster verwendet wird. Der Typ "SystemAssigned, UserAssigned" enthält sowohl eine implizit erstellte Identität als auch eine Gruppe von vom Benutzer zugewiesenen Identitäten.
|
|
ResourceProviderConnection
|
Die Richtung für die Ressourcenanbieterverbindung.
|
|
Role
|
Beschreibt eine Rolle im Cluster.
|
|
ScriptAction
|
Beschreibt eine Skriptaktion für die Rolle im Cluster.
|
|
SecurityProfile
|
Das Sicherheitsprofil, das ssh-öffentlichen Schlüssel für den HDInsight-Cluster enthält.
|
|
SshProfile
|
Die Liste der öffentlichen SSH-Schlüssel.
|
|
SshPublicKey
|
Der öffentliche SSH-Schlüssel für die Clusterknoten.
|
|
StorageAccount
|
Das Speicherkonto.
|
|
StorageProfile
|
Das Speicherprofil.
|
|
systemData
|
Metadaten zur Erstellung und letzten Änderung der Ressource.
|
|
Tier
|
Die Clusterebene.
|
|
UserAssignedIdentity
|
Die vom Benutzer zugewiesene Identität
|
|
VirtualNetworkProfile
|
Die Eigenschaften des virtuellen Netzwerks.
|
Autoscale
Objekt
Die Parameter für die AutoScale-Anforderung
AutoscaleCapacity
Objekt
Die ladebasierten AutoScale-Anforderungsparameter
| Name |
Typ |
Beschreibung |
|
maxInstanceCount
|
integer
(int32)
|
Die maximale Anzahl der Instanzen des Clusters
|
|
minInstanceCount
|
integer
(int32)
|
Die Mindestanzahl der Instanzen des Clusters
|
AutoscaleRecurrence
Objekt
Zeitplanbasierte Autoskalenanforderungsparameter
| Name |
Typ |
Beschreibung |
|
schedule
|
AutoscaleSchedule[]
|
Array von zeitplanbasierten Regeln für die automatische Skalierung
|
|
timeZone
|
string
|
Die Zeitzone für die Zeitpläne der automatischen Skalierung
|
AutoscaleSchedule
Objekt
Parameter für eine zeitplanbasierte Autoskalenregel, bestehend aus einem Array von Tagen und einer Zeit und Kapazität
| Name |
Typ |
Beschreibung |
|
days
|
DaysOfWeek[]
|
Wochentage für eine zeitplanbasierte Autoskalenregel
|
|
timeAndCapacity
|
AutoscaleTimeAndCapacity
|
Zeit und Kapazität für eine zeitplanbasierte Autoskalenregel
|
AutoscaleTimeAndCapacity
Objekt
Zeit- und Kapazitätsanforderungsparameter
| Name |
Typ |
Beschreibung |
|
maxInstanceCount
|
integer
(int32)
|
Die maximale Anzahl der Instanzen des Clusters
|
|
minInstanceCount
|
integer
(int32)
|
Die Mindestanzahl der Instanzen des Clusters
|
|
time
|
string
|
24-Stunden-Zeit im Formular xx:xx
|
ClientGroupInfo
Objekt
Die Informationen der AAD-Sicherheitsgruppe.
| Name |
Typ |
Beschreibung |
|
groupId
|
string
|
Die AAD-Sicherheitsgruppen-ID.
|
|
groupName
|
string
|
Der Name der AAD-Sicherheitsgruppe.
|
Cluster
Objekt
Der HDInsight-Cluster.
| Name |
Typ |
Beschreibung |
|
etag
|
string
|
Das ETag für die Ressource
|
|
id
|
string
|
Vollqualifizierte Ressourcen-ID für die Ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
identity
|
ClusterIdentity
|
Die Identität des Clusters, falls konfiguriert.
|
|
location
|
string
|
Der geografische Standort, an dem sich die Ressource befindet
|
|
name
|
string
|
Der Name der Ressource
|
|
properties
|
ClusterGetProperties
|
Die Eigenschaften des Clusters.
|
|
systemData
|
systemData
|
Metadaten zur Erstellung und letzten Änderung der Ressource.
|
|
tags
|
object
|
Ressourcentags.
|
|
type
|
string
|
Der Typ der Ressource. Z. B. "Microsoft.Compute/virtualMachines" oder "Microsoft.Storage/storageAccounts"
|
|
zones
|
string[]
|
Die Verfügbarkeitszonen.
|
ClusterCreateParametersExtended
Objekt
Die CreateCluster-Anforderungsparameter.
| Name |
Typ |
Beschreibung |
|
identity
|
ClusterIdentity
|
Die Identität des Clusters, falls konfiguriert.
|
|
location
|
string
|
Die Position des Clusters.
|
|
properties
|
ClusterCreateProperties
|
Der Cluster erstellt Parameter.
|
|
tags
|
object
|
Die Ressourcentags.
|
|
zones
|
string[]
|
Die Verfügbarkeitszonen.
|
ClusterCreateProperties
Objekt
Der Cluster erstellt Parameter.
ClusterDefinition
Objekt
Die Clusterdefinition.
| Name |
Typ |
Beschreibung |
|
blueprint
|
string
|
Der Link zum Blueprint.
|
|
componentVersion
|
object
|
Die Versionen verschiedener Dienste im Cluster.
|
|
configurations
|
object
|
Die Clusterkonfigurationen.
|
|
kind
|
string
|
Der Typ des Clusters.
|
ClusterGetProperties
Objekt
Die Eigenschaften des Clusters.
| Name |
Typ |
Beschreibung |
|
clusterDefinition
|
ClusterDefinition
|
Die Clusterdefinition.
|
|
clusterHdpVersion
|
string
|
Die HDP-Version des Clusters.
|
|
clusterId
|
string
|
Die Cluster-ID.
|
|
clusterState
|
string
|
Der Status des Clusters.
|
|
clusterVersion
|
string
|
Die Version des Clusters.
|
|
computeIsolationProperties
|
ComputeIsolationProperties
|
Die Computeisolationseigenschaften.
|
|
computeProfile
|
ComputeProfile
|
Das Computeprofil.
|
|
connectivityEndpoints
|
ConnectivityEndpoint[]
|
Die Liste der Verbindungsendpunkte.
|
|
createdDate
|
string
|
Das Datum, an dem der Cluster erstellt wurde.
|
|
diskEncryptionProperties
|
DiskEncryptionProperties
|
Die Datenträgerverschlüsselungseigenschaften.
|
|
encryptionInTransitProperties
|
EncryptionInTransitProperties
|
Die Verschlüsselungs-in-Transit-Eigenschaften.
|
|
errors
|
Errors[]
|
Die Liste der Fehler.
|
|
excludedServicesConfig
|
ExcludedServicesConfig
|
Die Konfiguration der ausgeschlossenen Dienste.
|
|
kafkaRestProperties
|
KafkaRestProperties
|
Die Cluster kafka-Restproxykonfiguration.
|
|
minSupportedTlsVersion
|
string
|
Die minimale unterstützte Tls-Version.
|
|
networkProperties
|
NetworkProperties
|
Die Netzwerkeigenschaften.
|
|
osType
|
OSType
|
Der Typ des Betriebssystems.
|
|
privateEndpointConnections
|
PrivateEndpointConnection[]
|
Die Liste der privaten Endpunktverbindungen.
|
|
privateLinkConfigurations
|
PrivateLinkConfiguration[]
|
Die Konfigurationen für private Verknüpfungen.
|
|
provisioningState
|
HDInsightClusterProvisioningState
|
Der Bereitstellungsstatus, der nur in der Antwort angezeigt wird.
|
|
quotaInfo
|
QuotaInfo
|
Die Kontingentinformationen.
|
|
securityProfile
|
SecurityProfile
|
Das Sicherheitsprofil.
|
|
storageProfile
|
StorageProfile
|
Das Speicherprofil.
|
|
tier
|
Tier
|
Die Clusterebene.
|
ClusterIdentity
Objekt
Identität für den Cluster.
| Name |
Typ |
Beschreibung |
|
principalId
|
string
|
Die Prinzipal-ID der Clusteridentität. Diese Eigenschaft wird nur für eine vom System zugewiesene Identität bereitgestellt.
|
|
tenantId
|
string
|
Die dem Cluster zugeordnete Mandanten-ID. Diese Eigenschaft wird nur für eine vom System zugewiesene Identität bereitgestellt.
|
|
type
|
ResourceIdentityType
|
Der Identitätstyp, der für den Cluster verwendet wird. Der Typ "SystemAssigned, UserAssigned" enthält sowohl eine implizit erstellte Identität als auch eine Gruppe von vom Benutzer zugewiesenen Identitäten.
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
Die Liste der Benutzeridentitäten, die dem Cluster zugeordnet sind. Die Benutzeridentitätswörterbuchschlüsselverweise sind ARM-Ressourcen-IDs im Formular: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}".
|
ComputeIsolationProperties
Objekt
Die Computeisolationseigenschaften.
| Name |
Typ |
Standardwert |
Beschreibung |
|
enableComputeIsolation
|
boolean
|
False
|
Das Flag gibt an, ob die Computeisolation aktiviert wird.
|
|
hostSku
|
string
|
|
Die Host-Sku.
|
ComputeProfile
Objekt
Beschreibt das Computeprofil.
| Name |
Typ |
Beschreibung |
|
roles
|
Role[]
|
Die Liste der Rollen im Cluster.
|
ConnectivityEndpoint
Objekt
Die Verbindungseigenschaften
| Name |
Typ |
Beschreibung |
|
location
|
string
|
Der Speicherort des Endpunkts.
|
|
name
|
string
|
Der Name des Endpunkts.
|
|
port
|
integer
(int32)
|
Der Port, mit dem eine Verbindung hergestellt werden soll.
|
|
privateIPAddress
|
string
|
Die private IP-Adresse des Endpunkts.
|
|
protocol
|
string
|
Das Protokoll des Endpunkts.
|
createdByType
Enumeration
Der Identitätstyp, der die Ressource erstellt hat.
| Wert |
Beschreibung |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
DataDisksGroups
Objekt
Die Datenträgergruppen für die Rolle.
| Name |
Typ |
Beschreibung |
|
diskSizeGB
|
integer
(int32)
|
Schreibgeschützt. Die DiskSize in GB. Legen Sie diesen Wert nicht fest.
|
|
disksPerNode
|
integer
(int32)
|
Die Anzahl der Datenträger pro Knoten.
|
|
storageAccountType
|
string
|
Schreibgeschützt. Der Speicherkontotyp. Legen Sie diesen Wert nicht fest.
|
DaysOfWeek
Enumeration
Wochentage für eine zeitplanbasierte Autoskalenregel
| Wert |
Beschreibung |
|
Monday
|
|
|
Tuesday
|
|
|
Wednesday
|
|
|
Thursday
|
|
|
Friday
|
|
|
Saturday
|
|
|
Sunday
|
|
DirectoryType
Enumeration
Der Verzeichnistyp.
| Wert |
Beschreibung |
|
ActiveDirectory
|
|
DiskEncryptionProperties
Objekt
Die Datenträgerverschlüsselungseigenschaften
| Name |
Typ |
Standardwert |
Beschreibung |
|
encryptionAlgorithm
|
JsonWebKeyEncryptionAlgorithm
|
|
Algorithmusbezeichner für Verschlüsselung, Standard RSA-OAEP.
|
|
encryptionAtHost
|
boolean
|
False
|
Gibt an, ob die Datenträgerverschlüsselung für Ressourcen aktiviert ist.
|
|
keyName
|
string
|
|
Schlüsselname, der zum Aktivieren der Datenträgerverschlüsselung verwendet wird.
|
|
keyVersion
|
string
|
|
Bestimmte Schlüsselversion, die zum Aktivieren der Datenträgerverschlüsselung verwendet wird.
|
|
msiResourceId
|
string
|
|
Ressourcen-ID der verwalteten Identität, die für den Zugriff auf den Schlüsseltresor verwendet wird.
|
|
vaultUri
|
string
|
|
Basis-Schlüsseltresor-URI, in dem sich der Kundenschlüssel befindet, z. B. https://myvault.vault.azure.net
|
EncryptionInTransitProperties
Objekt
Die Verschlüsselungs-in-Transit-Eigenschaften.
| Name |
Typ |
Standardwert |
Beschreibung |
|
isEncryptionInTransitEnabled
|
boolean
|
False
|
Gibt an, ob die Kommunikation zwischen Clusterknoten während der Übertragung verschlüsselt ist.
|
ErrorResponse
Objekt
Beschreibt das Format der Fehlerantwort.
| Name |
Typ |
Beschreibung |
|
code
|
string
|
Fehlercode
|
|
message
|
string
|
Fehlermeldung, die angibt, warum der Vorgang fehlgeschlagen ist.
|
Errors
Objekt
Die Fehlermeldung, die der Clustererstellung zugeordnet ist.
| Name |
Typ |
Beschreibung |
|
code
|
string
|
Der Fehlercode.
|
|
message
|
string
|
Die Fehlermeldung.
|
ExcludedServicesConfig
Objekt
Die Konfiguration, die dienste beim Erstellen des Clusters ausgeschlossen werden.
| Name |
Typ |
Beschreibung |
|
excludedServicesConfigId
|
string
|
Die Konfigurations-ID der ausgeschlossenen Dienste.
|
|
excludedServicesList
|
string
|
Die Liste der ausgeschlossenen Dienste.
|
HardwareProfile
Objekt
Das Hardwareprofil.
| Name |
Typ |
Beschreibung |
|
vmSize
|
string
|
Die Größe des virtuellen Computers
|
HDInsightClusterProvisioningState
Enumeration
Der Bereitstellungsstatus, der nur in der Antwort angezeigt wird.
| Wert |
Beschreibung |
|
InProgress
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
IPConfiguration
Objekt
Die IP-Konfigurationen für den privaten Linkdienst.
| Name |
Typ |
Beschreibung |
|
id
|
string
|
Die IP-Konfigurations-ID für private Links.
|
|
name
|
string
|
Der Name der IP-Konfiguration für private Links.
|
|
properties.primary
|
boolean
|
Gibt an, ob diese IP-Konfiguration primär für die entsprechende NIC ist.
|
|
properties.privateIPAddress
|
string
|
Die IP-Adresse.
|
|
properties.privateIPAllocationMethod
|
PrivateIPAllocationMethod
|
Die Methode, die private IP-Adresse zugewiesen wird.
|
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
Der Bereitstellungsstatus der Konfiguration für private Verknüpfungen, der nur in der Antwort angezeigt wird.
|
|
properties.subnet
|
ResourceId
|
Die Subnetzressourcen-ID.
|
|
type
|
string
|
Der Typ der IP-Konfiguration für private Links.
|
JsonWebKeyEncryptionAlgorithm
Enumeration
Algorithmusbezeichner für Verschlüsselung, Standard RSA-OAEP.
| Wert |
Beschreibung |
|
RSA-OAEP
|
|
|
RSA-OAEP-256
|
|
|
RSA1_5
|
|
KafkaRestProperties
Objekt
Die Kafka-Restproxykonfiguration, die AAD-Sicherheitsgruppeninformationen enthält.
| Name |
Typ |
Beschreibung |
|
clientGroupInfo
|
ClientGroupInfo
|
Die Informationen der AAD-Sicherheitsgruppe.
|
|
configurationOverride
|
object
|
Die Konfigurationen, die überschrieben werden müssen.
|
LinuxOperatingSystemProfile
Objekt
Der ssh-Benutzername, das Kennwort und der öffentliche SSH-Schlüssel.
| Name |
Typ |
Beschreibung |
|
password
|
string
|
Das Kennwort.
|
|
sshProfile
|
SshProfile
|
Das SSH-Profil.
|
|
username
|
string
|
Der Benutzername.
|
NetworkProperties
Objekt
Die Netzwerkeigenschaften.
| Name |
Typ |
Beschreibung |
|
privateLink
|
PrivateLink
|
Gibt an, ob der private Link aktiviert ist.
|
|
resourceProviderConnection
|
ResourceProviderConnection
|
Die Richtung für die Ressourcenanbieterverbindung.
|
OsProfile
Objekt
Das Profil der Linux-Betriebssysteme.
OSType
Enumeration
Der Typ des Betriebssystems.
| Wert |
Beschreibung |
|
Windows
|
|
|
Linux
|
|
PrivateEndpoint
Objekt
Der private Endpunkt.
| Name |
Typ |
Beschreibung |
|
id
|
string
|
Die ID des privaten Endpunkts.
|
PrivateEndpointConnection
Objekt
Die private Endpunktverbindung.
| Name |
Typ |
Beschreibung |
|
id
|
string
|
Vollqualifizierte Ressourcen-ID für die Ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
name
|
string
|
Der Name der Ressource
|
|
properties.linkIdentifier
|
string
|
Der Linkbezeichner.
|
|
properties.privateEndpoint
|
PrivateEndpoint
|
Der private Endpunkt der privaten Endpunktverbindung
|
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
Der Verbindungsstatus des privaten Verknüpfungsdiensts.
|
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
Der Bereitstellungsstatus, der nur in der Antwort angezeigt wird.
|
|
systemData
|
systemData
|
Metadaten zur Erstellung und letzten Änderung der Ressource.
|
|
type
|
string
|
Der Typ der Ressource. Z. B. "Microsoft.Compute/virtualMachines" oder "Microsoft.Storage/storageAccounts"
|
PrivateEndpointConnectionProvisioningState
Enumeration
Der Bereitstellungsstatus, der nur in der Antwort angezeigt wird.
| Wert |
Beschreibung |
|
InProgress
|
|
|
Updating
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
PrivateIPAllocationMethod
Enumeration
Die Methode, die private IP-Adresse zugewiesen wird.
| Wert |
Beschreibung |
|
dynamic
|
|
|
static
|
|
PrivateLink
Enumeration
Gibt an, ob der private Link aktiviert ist.
| Wert |
Beschreibung |
|
Disabled
|
|
|
Enabled
|
|
PrivateLinkConfiguration
Objekt
Die Konfiguration für private Verknüpfungen.
| Name |
Typ |
Beschreibung |
|
id
|
string
|
Die Konfigurations-ID für private Verknüpfungen.
|
|
name
|
string
|
Der Name der Konfiguration für private Verknüpfungen.
|
|
properties.groupId
|
string
|
Der Private Linkable-Unterressourcenname für HDInsight, auf den die Konfiguration für private Verknüpfungen angewendet werden soll. Beispiel: "headnode", "gateway", "edgenode".
|
|
properties.ipConfigurations
|
IPConfiguration[]
|
Die IP-Konfigurationen für den privaten Linkdienst.
|
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
Der Bereitstellungsstatus der Konfiguration für private Verknüpfungen, der nur in der Antwort angezeigt wird.
|
|
type
|
string
|
Der Typ der Konfiguration für private Verknüpfungen.
|
PrivateLinkConfigurationProvisioningState
Enumeration
Der Bereitstellungsstatus der Konfiguration für private Verknüpfungen, der nur in der Antwort angezeigt wird.
| Wert |
Beschreibung |
|
InProgress
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
PrivateLinkServiceConnectionState
Objekt
Der Verbindungsstatus des privaten Verknüpfungsdiensts.
| Name |
Typ |
Beschreibung |
|
actionsRequired
|
string
|
Ob es weitere Maßnahmen gibt.
|
|
description
|
string
|
Die optionale Beschreibung des Status.
|
|
status
|
PrivateLinkServiceConnectionStatus
|
Die konkrete Private Link Service-Verbindung.
|
PrivateLinkServiceConnectionStatus
Enumeration
Die konkrete Private Link Service-Verbindung.
| Wert |
Beschreibung |
|
Approved
|
|
|
Rejected
|
|
|
Pending
|
|
|
Removed
|
|
QuotaInfo
Objekt
Die Kontingenteigenschaften für den Cluster.
| Name |
Typ |
Beschreibung |
|
coresUsed
|
integer
(int32)
|
Die vom Cluster verwendeten Kerne.
|
ResourceId
Objekt
Die Azure-Ressourcen-ID.
| Name |
Typ |
Beschreibung |
|
id
|
string
|
Die Azure-Ressourcen-ID.
|
ResourceIdentityType
Enumeration
Der Identitätstyp, der für den Cluster verwendet wird. Der Typ "SystemAssigned, UserAssigned" enthält sowohl eine implizit erstellte Identität als auch eine Gruppe von vom Benutzer zugewiesenen Identitäten.
| Wert |
Beschreibung |
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
SystemAssigned, UserAssigned
|
|
|
None
|
|
ResourceProviderConnection
Enumeration
Die Richtung für die Ressourcenanbieterverbindung.
| Wert |
Beschreibung |
|
Inbound
|
|
|
Outbound
|
|
Role
Objekt
Beschreibt eine Rolle im Cluster.
| Name |
Typ |
Standardwert |
Beschreibung |
|
VMGroupName
|
string
|
|
Der Name der Gruppe des virtuellen Computers.
|
|
autoscale
|
Autoscale
|
|
Die Konfigurationen für die automatische Skalierung.
|
|
dataDisksGroups
|
DataDisksGroups[]
|
|
Die Datenträgergruppen für die Rolle.
|
|
encryptDataDisks
|
boolean
|
False
|
Gibt an, ob die Datenträger verschlüsselt werden.
|
|
hardwareProfile
|
HardwareProfile
|
|
Das Hardwareprofil.
|
|
minInstanceCount
|
integer
(int32)
|
|
Die Mindestanzahl der Instanzen des Clusters.
|
|
name
|
string
|
|
Der Name der Rolle.
|
|
osProfile
|
OsProfile
|
|
Das Betriebssystemprofil.
|
|
scriptActions
|
ScriptAction[]
|
|
Die Liste der Skriptaktionen für die Rolle.
|
|
targetInstanceCount
|
integer
(int32)
|
|
Die Instanzanzahl des Clusters.
|
|
virtualNetworkProfile
|
VirtualNetworkProfile
|
|
Das virtuelle Netzwerkprofil.
|
ScriptAction
Objekt
Beschreibt eine Skriptaktion für die Rolle im Cluster.
| Name |
Typ |
Beschreibung |
|
name
|
string
|
Der Name der Skriptaktion.
|
|
parameters
|
string
|
Die Parameter für das bereitgestellte Skript.
|
|
uri
|
string
|
Der URI für das Skript.
|
SecurityProfile
Objekt
Das Sicherheitsprofil, das ssh-öffentlichen Schlüssel für den HDInsight-Cluster enthält.
| Name |
Typ |
Beschreibung |
|
aaddsResourceId
|
string
|
Die Ressourcen-ID des Azure Active Directory-Domänendiensts des Benutzers.
|
|
clusterUsersGroupDNs
|
string[]
|
Wahlfrei. Die Distinguished Names for cluster user groups
|
|
directoryType
|
DirectoryType
|
Der Verzeichnistyp.
|
|
domain
|
string
|
Die Active Directory-Domäne der Organisation.
|
|
domainUserPassword
|
string
(password)
|
Das Kennwort des Domänenadministrators.
|
|
domainUsername
|
string
|
Das Domänenbenutzerkonto, das Über Administratorrechte für den Cluster verfügt.
|
|
ldapsUrls
|
string[]
|
Die LDAPS-Protokoll-URLs für die Kommunikation mit Active Directory.
|
|
msiResourceId
|
string
|
Benutzer zugewiesene Identität, die über Berechtigungen zum Lesen und Erstellen clusterbezogener Artefakte in der AADDS des Benutzers verfügt.
|
|
organizationalUnitDN
|
string
|
Die Organisationseinheit in Active Directory, um den Cluster und dienstkonten zu platzieren.
|
SshProfile
Objekt
Die Liste der öffentlichen SSH-Schlüssel.
| Name |
Typ |
Beschreibung |
|
publicKeys
|
SshPublicKey[]
|
Die Liste der öffentlichen SSH-Schlüssel.
|
SshPublicKey
Objekt
Der öffentliche SSH-Schlüssel für die Clusterknoten.
| Name |
Typ |
Beschreibung |
|
certificateData
|
string
|
Das Zertifikat für SSH.
|
StorageAccount
Objekt
Das Speicherkonto.
| Name |
Typ |
Beschreibung |
|
container
|
string
|
Der Container im Speicherkonto, der nur für WASB-Speicherkonten angegeben werden soll.
|
|
fileSystem
|
string
|
Das Dateisystem, das nur für Azure Data Lake Storage Gen 2 angegeben werden soll.
|
|
fileshare
|
string
|
Der Dateifreigabename.
|
|
isDefault
|
boolean
|
Gibt an, ob das Speicherkonto das Standardspeicherkonto ist.
|
|
key
|
string
|
Der Zugriffsschlüssel für das Speicherkonto.
|
|
msiResourceId
|
string
|
Die verwaltete Identität (MSI), die auf das Speicherkonto zugreifen darf, muss nur für Azure Data Lake Storage Gen 2 angegeben werden.
|
|
name
|
string
|
Der Name des Speicherkontos.
|
|
resourceId
|
string
|
Die Ressourcen-ID des Speicherkontos, die nur für Azure Data Lake Storage Gen 2 angegeben werden soll.
|
|
saskey
|
string
|
Der Signaturschlüssel für den freigegebenen Zugriff.
|
StorageProfile
Objekt
Das Speicherprofil.
| Name |
Typ |
Beschreibung |
|
storageaccounts
|
StorageAccount[]
|
Die Liste der Speicherkonten im Cluster.
|
systemData
Objekt
Metadaten zur Erstellung und letzten Änderung der Ressource.
| Name |
Typ |
Beschreibung |
|
createdAt
|
string
(date-time)
|
Der Zeitstempel der Ressourcenerstellung (UTC).
|
|
createdBy
|
string
|
Die Identität, die die Ressource erstellt hat.
|
|
createdByType
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
|
lastModifiedAt
|
string
(date-time)
|
Der Zeitstempel der letzten Änderung der Ressource (UTC)
|
|
lastModifiedBy
|
string
|
Die Identität, die die Ressource zuletzt geändert hat.
|
|
lastModifiedByType
|
createdByType
|
Der Identitätstyp, der die Ressource zuletzt geändert hat.
|
Tier
Enumeration
Die Clusterebene.
| Wert |
Beschreibung |
|
Standard
|
|
|
Premium
|
|
UserAssignedIdentity
Objekt
Die vom Benutzer zugewiesene Identität
| Name |
Typ |
Beschreibung |
|
clientId
|
string
|
Die Client-ID der vom Benutzer zugewiesenen Identität.
|
|
principalId
|
string
|
Die Prinzipal-ID der vom Benutzer zugewiesenen Identität.
|
|
tenantId
|
string
|
Die Mandanten-ID der vom Benutzer zugewiesenen Identität.
|
VirtualNetworkProfile
Objekt
Die Eigenschaften des virtuellen Netzwerks.
| Name |
Typ |
Beschreibung |
|
id
|
string
|
Die ID des virtuellen Netzwerks.
|
|
subnet
|
string
|
Der Name des Subnetzes.
|