Creates a new HDInsight cluster with the specified parameters.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}?api-version=2021-06-01
URI Parameters
Name |
In |
Required |
Type |
Description |
clusterName
|
path |
True
|
string
|
The name of the cluster.
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group.
|
subscriptionId
|
path |
True
|
string
|
The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
The HDInsight client API Version.
|
Request Body
Name |
Type |
Description |
identity
|
ClusterIdentity
|
The identity of the cluster, if configured.
|
location
|
string
|
The location of the cluster.
|
properties
|
ClusterCreateProperties
|
The cluster create parameters.
|
tags
|
object
|
The resource tags.
|
zones
|
string[]
|
The availability zones.
|
Responses
Name |
Type |
Description |
200 OK
|
Cluster
|
OK response definition.
|
Other Status Codes
|
ErrorResponse
|
Error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
Create cluster with availability zones
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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
Sample request
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
Sample response
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"
}
}
Definitions
Autoscale
The autoscale request parameters
AutoscaleCapacity
The load-based autoscale request parameters
Name |
Type |
Description |
maxInstanceCount
|
integer
|
The maximum instance count of the cluster
|
minInstanceCount
|
integer
|
The minimum instance count of the cluster
|
AutoscaleRecurrence
Schedule-based autoscale request parameters
Name |
Type |
Description |
schedule
|
AutoscaleSchedule[]
|
Array of schedule-based autoscale rules
|
timeZone
|
string
|
The time zone for the autoscale schedule times
|
AutoscaleSchedule
Parameters for a schedule-based autoscale rule, consisting of an array of days + a time and capacity
Name |
Type |
Description |
days
|
DaysOfWeek[]
|
Days of the week for a schedule-based autoscale rule
|
timeAndCapacity
|
AutoscaleTimeAndCapacity
|
Time and capacity for a schedule-based autoscale rule
|
AutoscaleTimeAndCapacity
Time and capacity request parameters
Name |
Type |
Description |
maxInstanceCount
|
integer
|
The maximum instance count of the cluster
|
minInstanceCount
|
integer
|
The minimum instance count of the cluster
|
time
|
string
|
24-hour time in the form xx:xx
|
ClientGroupInfo
The information of AAD security group.
Name |
Type |
Description |
groupId
|
string
|
The AAD security group id.
|
groupName
|
string
|
The AAD security group name.
|
Cluster
The HDInsight cluster.
Name |
Type |
Description |
etag
|
string
|
The ETag for the resource
|
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
ClusterIdentity
|
The identity of the cluster, if configured.
|
location
|
string
|
The geo-location where the resource lives
|
name
|
string
|
The name of the resource
|
properties
|
ClusterGetProperties
|
The properties of the cluster.
|
systemData
|
systemData
|
Metadata pertaining to creation and last modification of the resource.
|
tags
|
object
|
Resource tags.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
zones
|
string[]
|
The availability zones.
|
ClusterCreateParametersExtended
The CreateCluster request parameters.
Name |
Type |
Description |
identity
|
ClusterIdentity
|
The identity of the cluster, if configured.
|
location
|
string
|
The location of the cluster.
|
properties
|
ClusterCreateProperties
|
The cluster create parameters.
|
tags
|
object
|
The resource tags.
|
zones
|
string[]
|
The availability zones.
|
ClusterCreateProperties
The cluster create parameters.
ClusterDefinition
The cluster definition.
Name |
Type |
Description |
blueprint
|
string
|
The link to the blueprint.
|
componentVersion
|
object
|
The versions of different services in the cluster.
|
configurations
|
object
|
The cluster configurations.
|
kind
|
string
|
The type of cluster.
|
ClusterGetProperties
The properties of cluster.
ClusterIdentity
Identity for the cluster.
Name |
Type |
Description |
principalId
|
string
|
The principal id of cluster identity. This property will only be provided for a system assigned identity.
|
tenantId
|
string
|
The tenant id associated with the cluster. This property will only be provided for a system assigned identity.
|
type
|
ResourceIdentityType
|
The type of identity used for the cluster. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities.
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
The list of user identities associated with the cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
|
ComputeIsolationProperties
The compute isolation properties.
Name |
Type |
Default value |
Description |
enableComputeIsolation
|
boolean
|
False
|
The flag indicates whether enable compute isolation or not.
|
hostSku
|
string
|
|
The host sku.
|
ComputeProfile
Describes the compute profile.
Name |
Type |
Description |
roles
|
Role[]
|
The list of roles in the cluster.
|
ConnectivityEndpoint
The connectivity properties
Name |
Type |
Description |
location
|
string
|
The location of the endpoint.
|
name
|
string
|
The name of the endpoint.
|
port
|
integer
|
The port to connect to.
|
privateIPAddress
|
string
|
The private ip address of the endpoint.
|
protocol
|
string
|
The protocol of the endpoint.
|
createdByType
The type of identity that created the resource.
Name |
Type |
Description |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
DataDisksGroups
The data disks groups for the role.
Name |
Type |
Description |
diskSizeGB
|
integer
|
ReadOnly. The DiskSize in GB. Do not set this value.
|
disksPerNode
|
integer
|
The number of disks per node.
|
storageAccountType
|
string
|
ReadOnly. The storage account type. Do not set this value.
|
DaysOfWeek
Days of the week for a schedule-based autoscale rule
Name |
Type |
Description |
Friday
|
string
|
|
Monday
|
string
|
|
Saturday
|
string
|
|
Sunday
|
string
|
|
Thursday
|
string
|
|
Tuesday
|
string
|
|
Wednesday
|
string
|
|
DirectoryType
The directory type.
Name |
Type |
Description |
ActiveDirectory
|
string
|
|
DiskEncryptionProperties
The disk encryption properties
Name |
Type |
Default value |
Description |
encryptionAlgorithm
|
JsonWebKeyEncryptionAlgorithm
|
|
Algorithm identifier for encryption, default RSA-OAEP.
|
encryptionAtHost
|
boolean
|
False
|
Indicates whether or not resource disk encryption is enabled.
|
keyName
|
string
|
|
Key name that is used for enabling disk encryption.
|
keyVersion
|
string
|
|
Specific key version that is used for enabling disk encryption.
|
msiResourceId
|
string
|
|
Resource ID of Managed Identity that is used to access the key vault.
|
vaultUri
|
string
|
|
Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net
|
EncryptionInTransitProperties
The encryption-in-transit properties.
Name |
Type |
Default value |
Description |
isEncryptionInTransitEnabled
|
boolean
|
False
|
Indicates whether or not inter cluster node communication is encrypted in transit.
|
ErrorResponse
Describes the format of Error response.
Name |
Type |
Description |
code
|
string
|
Error code
|
message
|
string
|
Error message indicating why the operation failed.
|
Errors
The error message associated with the cluster creation.
Name |
Type |
Description |
code
|
string
|
The error code.
|
message
|
string
|
The error message.
|
ExcludedServicesConfig
The configuration that services will be excluded when creating cluster.
Name |
Type |
Description |
excludedServicesConfigId
|
string
|
The config id of excluded services.
|
excludedServicesList
|
string
|
The list of excluded services.
|
HardwareProfile
The hardware profile.
Name |
Type |
Description |
vmSize
|
string
|
The size of the VM
|
HDInsightClusterProvisioningState
The provisioning state, which only appears in the response.
Name |
Type |
Description |
Canceled
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
InProgress
|
string
|
|
Succeeded
|
string
|
|
IPConfiguration
The ip configurations for the private link service.
Name |
Type |
Description |
id
|
string
|
The private link IP configuration id.
|
name
|
string
|
The name of private link IP configuration.
|
properties.primary
|
boolean
|
Indicates whether this IP configuration is primary for the corresponding NIC.
|
properties.privateIPAddress
|
string
|
The IP address.
|
properties.privateIPAllocationMethod
|
PrivateIPAllocationMethod
|
The method that private IP address is allocated.
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
The private link configuration provisioning state, which only appears in the response.
|
properties.subnet
|
ResourceId
|
The subnet resource id.
|
type
|
string
|
The type of the private link IP configuration.
|
JsonWebKeyEncryptionAlgorithm
Algorithm identifier for encryption, default RSA-OAEP.
Name |
Type |
Description |
RSA-OAEP
|
string
|
|
RSA-OAEP-256
|
string
|
|
RSA1_5
|
string
|
|
KafkaRestProperties
The kafka rest proxy configuration which contains AAD security group information.
Name |
Type |
Description |
clientGroupInfo
|
ClientGroupInfo
|
The information of AAD security group.
|
configurationOverride
|
object
|
The configurations that need to be overriden.
|
LinuxOperatingSystemProfile
The ssh username, password, and ssh public key.
Name |
Type |
Description |
password
|
string
|
The password.
|
sshProfile
|
SshProfile
|
The SSH profile.
|
username
|
string
|
The username.
|
NetworkProperties
The network properties.
Name |
Type |
Description |
privateLink
|
PrivateLink
|
Indicates whether or not private link is enabled.
|
resourceProviderConnection
|
ResourceProviderConnection
|
The direction for the resource provider connection.
|
OsProfile
The Linux operation systems profile.
OSType
The type of operating system.
Name |
Type |
Description |
Linux
|
string
|
|
Windows
|
string
|
|
PrivateEndpoint
The private endpoint.
Name |
Type |
Description |
id
|
string
|
The private endpoint id.
|
PrivateEndpointConnection
The private endpoint connection.
Name |
Type |
Description |
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
The name of the resource
|
properties.linkIdentifier
|
string
|
The link identifier.
|
properties.privateEndpoint
|
PrivateEndpoint
|
The private endpoint of the private endpoint connection
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
The private link service connection state.
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
The provisioning state, which only appears in the response.
|
systemData
|
systemData
|
Metadata pertaining to creation and last modification of the resource.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
PrivateEndpointConnectionProvisioningState
The provisioning state, which only appears in the response.
Name |
Type |
Description |
Canceled
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
InProgress
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
PrivateIPAllocationMethod
The method that private IP address is allocated.
Name |
Type |
Description |
dynamic
|
string
|
|
static
|
string
|
|
PrivateLink
Indicates whether or not private link is enabled.
Name |
Type |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
PrivateLinkConfiguration
The private link configuration.
Name |
Type |
Description |
id
|
string
|
The private link configuration id.
|
name
|
string
|
The name of private link configuration.
|
properties.groupId
|
string
|
The HDInsight private linkable sub-resource name to apply the private link configuration to. For example, 'headnode', 'gateway', 'edgenode'.
|
properties.ipConfigurations
|
IPConfiguration[]
|
The IP configurations for the private link service.
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
The private link configuration provisioning state, which only appears in the response.
|
type
|
string
|
The type of the private link configuration.
|
PrivateLinkConfigurationProvisioningState
The private link configuration provisioning state, which only appears in the response.
Name |
Type |
Description |
Canceled
|
string
|
|
Deleting
|
string
|
|
Failed
|
string
|
|
InProgress
|
string
|
|
Succeeded
|
string
|
|
PrivateLinkServiceConnectionState
The private link service connection state.
Name |
Type |
Description |
actionsRequired
|
string
|
Whether there is further actions.
|
description
|
string
|
The optional description of the status.
|
status
|
PrivateLinkServiceConnectionStatus
|
The concrete private link service connection.
|
PrivateLinkServiceConnectionStatus
The concrete private link service connection.
Name |
Type |
Description |
Approved
|
string
|
|
Pending
|
string
|
|
Rejected
|
string
|
|
Removed
|
string
|
|
QuotaInfo
The quota properties for the cluster.
Name |
Type |
Description |
coresUsed
|
integer
|
The cores used by the cluster.
|
ResourceId
The azure resource id.
Name |
Type |
Description |
id
|
string
|
The azure resource id.
|
ResourceIdentityType
The type of identity used for the cluster. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities.
Name |
Type |
Description |
None
|
string
|
|
SystemAssigned
|
string
|
|
SystemAssigned, UserAssigned
|
string
|
|
UserAssigned
|
string
|
|
ResourceProviderConnection
The direction for the resource provider connection.
Name |
Type |
Description |
Inbound
|
string
|
|
Outbound
|
string
|
|
Role
Describes a role on the cluster.
Name |
Type |
Default value |
Description |
VMGroupName
|
string
|
|
The name of the virtual machine group.
|
autoscale
|
Autoscale
|
|
The autoscale configurations.
|
dataDisksGroups
|
DataDisksGroups[]
|
|
The data disks groups for the role.
|
encryptDataDisks
|
boolean
|
False
|
Indicates whether encrypt the data disks.
|
hardwareProfile
|
HardwareProfile
|
|
The hardware profile.
|
minInstanceCount
|
integer
|
|
The minimum instance count of the cluster.
|
name
|
string
|
|
The name of the role.
|
osProfile
|
OsProfile
|
|
The operating system profile.
|
scriptActions
|
ScriptAction[]
|
|
The list of script actions on the role.
|
targetInstanceCount
|
integer
|
|
The instance count of the cluster.
|
virtualNetworkProfile
|
VirtualNetworkProfile
|
|
The virtual network profile.
|
ScriptAction
Describes a script action on role on the cluster.
Name |
Type |
Description |
name
|
string
|
The name of the script action.
|
parameters
|
string
|
The parameters for the script provided.
|
uri
|
string
|
The URI to the script.
|
SecurityProfile
The security profile which contains Ssh public key for the HDInsight cluster.
Name |
Type |
Description |
aaddsResourceId
|
string
|
The resource ID of the user's Azure Active Directory Domain Service.
|
clusterUsersGroupDNs
|
string[]
|
Optional. The Distinguished Names for cluster user groups
|
directoryType
|
DirectoryType
|
The directory type.
|
domain
|
string
|
The organization's active directory domain.
|
domainUserPassword
|
string
|
The domain admin password.
|
domainUsername
|
string
|
The domain user account that will have admin privileges on the cluster.
|
ldapsUrls
|
string[]
|
The LDAPS protocol URLs to communicate with the Active Directory.
|
msiResourceId
|
string
|
User assigned identity that has permissions to read and create cluster-related artifacts in the user's AADDS.
|
organizationalUnitDN
|
string
|
The organizational unit within the Active Directory to place the cluster and service accounts.
|
SshProfile
The list of SSH public keys.
Name |
Type |
Description |
publicKeys
|
SshPublicKey[]
|
The list of SSH public keys.
|
SshPublicKey
The SSH public key for the cluster nodes.
Name |
Type |
Description |
certificateData
|
string
|
The certificate for SSH.
|
StorageAccount
The storage Account.
Name |
Type |
Description |
container
|
string
|
The container in the storage account, only to be specified for WASB storage accounts.
|
fileSystem
|
string
|
The filesystem, only to be specified for Azure Data Lake Storage Gen 2.
|
fileshare
|
string
|
The file share name.
|
isDefault
|
boolean
|
Whether or not the storage account is the default storage account.
|
key
|
string
|
The storage account access key.
|
msiResourceId
|
string
|
The managed identity (MSI) that is allowed to access the storage account, only to be specified for Azure Data Lake Storage Gen 2.
|
name
|
string
|
The name of the storage account.
|
resourceId
|
string
|
The resource ID of storage account, only to be specified for Azure Data Lake Storage Gen 2.
|
saskey
|
string
|
The shared access signature key.
|
StorageProfile
The storage profile.
Name |
Type |
Description |
storageaccounts
|
StorageAccount[]
|
The list of storage accounts in the cluster.
|
systemData
Metadata pertaining to creation and last modification of the resource.
Name |
Type |
Description |
createdAt
|
string
|
The timestamp of resource creation (UTC).
|
createdBy
|
string
|
The identity that created the resource.
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
lastModifiedAt
|
string
|
The timestamp of resource last modification (UTC)
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|
Tier
The cluster tier.
Name |
Type |
Description |
Premium
|
string
|
|
Standard
|
string
|
|
UserAssignedIdentity
The User Assigned Identity
Name |
Type |
Description |
clientId
|
string
|
The client id of user assigned identity.
|
principalId
|
string
|
The principal id of user assigned identity.
|
tenantId
|
string
|
The tenant id of user assigned identity.
|
VirtualNetworkProfile
The virtual network properties.
Name |
Type |
Description |
id
|
string
|
The ID of the virtual network.
|
subnet
|
string
|
The name of the subnet.
|