Cria um novo cluster HDInsight com os parâmetros especificados.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}?api-version=2021-06-01
Parâmetros de URI
| Nome |
Em |
Obrigatório |
Tipo |
Description |
|
clusterName
|
path |
True
|
string
|
O nome do cluster.
|
|
resourceGroupName
|
path |
True
|
string
|
O nome do grupo de recursos.
|
|
subscriptionId
|
path |
True
|
string
|
As credenciais de assinatura que identificam exclusivamente a assinatura do Microsoft Azure. A ID da assinatura faz parte do URI para cada chamada de serviço.
|
|
api-version
|
query |
True
|
string
|
A versão da API do cliente HDInsight.
|
Corpo da solicitação
| Nome |
Tipo |
Description |
|
identity
|
ClusterIdentity
|
A identidade do cluster, se configurada.
|
|
location
|
string
|
O local do cluster.
|
|
properties
|
ClusterCreateProperties
|
Os parâmetros de criação do cluster.
|
|
tags
|
object
|
As marcas de recurso.
|
|
zones
|
string[]
|
As zonas de disponibilidade.
|
Respostas
| Nome |
Tipo |
Description |
|
200 OK
|
Cluster
|
Definição de resposta OK.
|
|
Other Status Codes
|
ErrorResponse
|
Resposta de erro que descreve por que a operação falhou.
|
Segurança
azure_auth
Fluxo OAuth2 do Azure Active Directory
Tipo:
oauth2
Flow:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Escopos
| Nome |
Description |
|
user_impersonation
|
representar sua conta de usuário
|
Exemplos
Create cluster with availability zones
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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
Solicitação de exemplo
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
Resposta de exemplo
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"
}
}
Definições
Autoscale
Objeto
Os parâmetros de solicitação de dimensionamento automático
| Nome |
Tipo |
Description |
|
capacity
|
AutoscaleCapacity
|
Parâmetros para dimensionamento automático baseado em carga
|
|
recurrence
|
AutoscaleRecurrence
|
Parâmetros para dimensionamento automático baseado em agendamento
|
AutoscaleCapacity
Objeto
Os parâmetros de solicitação de dimensionamento automático baseados em carga
| Nome |
Tipo |
Description |
|
maxInstanceCount
|
integer
(int32)
|
A contagem máxima de instâncias do cluster
|
|
minInstanceCount
|
integer
(int32)
|
A contagem mínima de instâncias do cluster
|
AutoscaleRecurrence
Objeto
Parâmetros de solicitação de dimensionamento automático baseado em agendamento
| Nome |
Tipo |
Description |
|
schedule
|
AutoscaleSchedule[]
|
Matriz de regras de dimensionamento automático baseadas em agendamento
|
|
timeZone
|
string
|
O fuso horário para os horários de agendamento de dimensionamento automático
|
AutoscaleSchedule
Objeto
Parâmetros para uma regra de dimensionamento automático baseada em agendamento, que consiste em uma matriz de dias + uma hora e capacidade
| Nome |
Tipo |
Description |
|
days
|
DaysOfWeek[]
|
Dias da semana para uma regra de dimensionamento automático baseada em agendamento
|
|
timeAndCapacity
|
AutoscaleTimeAndCapacity
|
Tempo e capacidade para uma regra de dimensionamento automático baseada em agendamento
|
AutoscaleTimeAndCapacity
Objeto
Parâmetros de solicitação de tempo e capacidade
| Nome |
Tipo |
Description |
|
maxInstanceCount
|
integer
(int32)
|
A contagem máxima de instâncias do cluster
|
|
minInstanceCount
|
integer
(int32)
|
A contagem mínima de instâncias do cluster
|
|
time
|
string
|
Hora de 24 horas no formulário xx:xx
|
ClientGroupInfo
Objeto
As informações do grupo de segurança do AAD.
| Nome |
Tipo |
Description |
|
groupId
|
string
|
A ID do grupo de segurança do AAD.
|
|
groupName
|
string
|
O nome do grupo de segurança do AAD.
|
Cluster
Objeto
O cluster HDInsight.
| Nome |
Tipo |
Description |
|
etag
|
string
|
A ETag para o recurso
|
|
id
|
string
|
ID de recurso totalmente qualificada para o recurso. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
identity
|
ClusterIdentity
|
A identidade do cluster, se configurada.
|
|
location
|
string
|
A localização geográfica onde o recurso reside
|
|
name
|
string
|
O nome do recurso
|
|
properties
|
ClusterGetProperties
|
As propriedades do cluster.
|
|
systemData
|
systemData
|
Metadados relativos à criação e última modificação do recurso.
|
|
tags
|
object
|
Marcas de recurso.
|
|
type
|
string
|
O tipo do recurso. Por exemplo, "Microsoft.Compute/virtualMachines" ou "Microsoft.Storage/storageAccounts"
|
|
zones
|
string[]
|
As zonas de disponibilidade.
|
ClusterCreateParametersExtended
Objeto
Os parâmetros de solicitação CreateCluster.
| Nome |
Tipo |
Description |
|
identity
|
ClusterIdentity
|
A identidade do cluster, se configurada.
|
|
location
|
string
|
O local do cluster.
|
|
properties
|
ClusterCreateProperties
|
Os parâmetros de criação do cluster.
|
|
tags
|
object
|
As marcas de recurso.
|
|
zones
|
string[]
|
As zonas de disponibilidade.
|
ClusterCreateProperties
Objeto
Os parâmetros de criação do cluster.
ClusterDefinition
Objeto
A definição do cluster.
| Nome |
Tipo |
Description |
|
blueprint
|
string
|
O link para o blueprint.
|
|
componentVersion
|
object
|
As versões de serviços diferentes no cluster.
|
|
configurations
|
object
|
As configurações do cluster.
|
|
kind
|
string
|
O tipo de cluster.
|
ClusterGetProperties
Objeto
As propriedades do cluster.
| Nome |
Tipo |
Description |
|
clusterDefinition
|
ClusterDefinition
|
A definição do cluster.
|
|
clusterHdpVersion
|
string
|
A versão hdp do cluster.
|
|
clusterId
|
string
|
A ID do cluster.
|
|
clusterState
|
string
|
O estado do cluster.
|
|
clusterVersion
|
string
|
A versão do cluster.
|
|
computeIsolationProperties
|
ComputeIsolationProperties
|
As propriedades de isolamento de computação.
|
|
computeProfile
|
ComputeProfile
|
O perfil de computação.
|
|
connectivityEndpoints
|
ConnectivityEndpoint[]
|
A lista de pontos de extremidade de conectividade.
|
|
createdDate
|
string
|
A data em que o cluster foi criado.
|
|
diskEncryptionProperties
|
DiskEncryptionProperties
|
As propriedades de criptografia de disco.
|
|
encryptionInTransitProperties
|
EncryptionInTransitProperties
|
As propriedades de criptografia em trânsito.
|
|
errors
|
Errors[]
|
A lista de erros.
|
|
excludedServicesConfig
|
ExcludedServicesConfig
|
A configuração de serviços excluídos.
|
|
kafkaRestProperties
|
KafkaRestProperties
|
A configuração do proxy rest kafka do cluster.
|
|
minSupportedTlsVersion
|
string
|
A versão mínima de tls com suporte.
|
|
networkProperties
|
NetworkProperties
|
As propriedades de rede.
|
|
osType
|
OSType
|
O tipo de sistema operacional.
|
|
privateEndpointConnections
|
PrivateEndpointConnection[]
|
A lista de conexões de ponto de extremidade privado.
|
|
privateLinkConfigurations
|
PrivateLinkConfiguration[]
|
As configurações de link privado.
|
|
provisioningState
|
HDInsightClusterProvisioningState
|
O estado de provisionamento, que aparece apenas na resposta.
|
|
quotaInfo
|
QuotaInfo
|
As informações de cota.
|
|
securityProfile
|
SecurityProfile
|
O perfil de segurança.
|
|
storageProfile
|
StorageProfile
|
O perfil de armazenamento.
|
|
tier
|
Tier
|
A camada de cluster.
|
ClusterIdentity
Objeto
Identidade para o cluster.
| Nome |
Tipo |
Description |
|
principalId
|
string
|
A ID principal da identidade do cluster. Essa propriedade será fornecida apenas para uma identidade atribuída pelo sistema.
|
|
tenantId
|
string
|
A ID do locatário associada ao cluster. Essa propriedade será fornecida apenas para uma identidade atribuída pelo sistema.
|
|
type
|
ResourceIdentityType
|
O tipo de identidade usado para o cluster. O tipo 'SystemAssigned, UserAssigned' inclui uma identidade criada implicitamente e um conjunto de identidades atribuídas pelo usuário.
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
A lista de identidades de usuário associadas ao cluster. As referências de chave do dicionário de identidade do usuário serão IDs de recurso do ARM no formulário: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
|
ComputeIsolationProperties
Objeto
As propriedades de isolamento de computação.
| Nome |
Tipo |
Valor padrão |
Description |
|
enableComputeIsolation
|
boolean
|
False
|
O sinalizador indica se habilita o isolamento de computação ou não.
|
|
hostSku
|
string
|
|
O sku do host.
|
ComputeProfile
Objeto
Descreve o perfil de computação.
| Nome |
Tipo |
Description |
|
roles
|
Role[]
|
A lista de funções no cluster.
|
ConnectivityEndpoint
Objeto
As propriedades de conectividade
| Nome |
Tipo |
Description |
|
location
|
string
|
O local do ponto de extremidade.
|
|
name
|
string
|
O nome do ponto de extremidade.
|
|
port
|
integer
(int32)
|
A porta à qual se conectar.
|
|
privateIPAddress
|
string
|
O endereço IP privado do ponto de extremidade.
|
|
protocol
|
string
|
O protocolo do ponto de extremidade.
|
createdByType
Enumeração
O tipo de identidade que criou o recurso.
| Valor |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
DataDisksGroups
Objeto
Os grupos de discos de dados para a função.
| Nome |
Tipo |
Description |
|
diskSizeGB
|
integer
(int32)
|
Somente leitura. O DiskSize em GB. Não defina esse valor.
|
|
disksPerNode
|
integer
(int32)
|
O número de discos por nó.
|
|
storageAccountType
|
string
|
Somente leitura. O tipo de conta de armazenamento. Não defina esse valor.
|
DaysOfWeek
Enumeração
Dias da semana para uma regra de dimensionamento automático baseada em agendamento
| Valor |
Description |
|
Monday
|
|
|
Tuesday
|
|
|
Wednesday
|
|
|
Thursday
|
|
|
Friday
|
|
|
Saturday
|
|
|
Sunday
|
|
DirectoryType
Enumeração
O tipo de diretório.
| Valor |
Description |
|
ActiveDirectory
|
|
DiskEncryptionProperties
Objeto
As propriedades de criptografia de disco
| Nome |
Tipo |
Valor padrão |
Description |
|
encryptionAlgorithm
|
JsonWebKeyEncryptionAlgorithm
|
|
Identificador de algoritmo para criptografia, RSA-OAEP padrão.
|
|
encryptionAtHost
|
boolean
|
False
|
Indica se a criptografia de disco de recurso está habilitada ou não.
|
|
keyName
|
string
|
|
Nome da chave usado para habilitar a criptografia de disco.
|
|
keyVersion
|
string
|
|
Versão de chave específica usada para habilitar a criptografia de disco.
|
|
msiResourceId
|
string
|
|
ID de recurso da Identidade Gerenciada que é usada para acessar o cofre de chaves.
|
|
vaultUri
|
string
|
|
URI do cofre de chaves base onde a chave de clientes está localizada, por exemplo. https://myvault.vault.azure.net
|
EncryptionInTransitProperties
Objeto
As propriedades de criptografia em trânsito.
| Nome |
Tipo |
Valor padrão |
Description |
|
isEncryptionInTransitEnabled
|
boolean
|
False
|
Indica se a comunicação entre nós de cluster é criptografada ou não em trânsito.
|
ErrorResponse
Objeto
Descreve o formato da resposta de erro.
| Nome |
Tipo |
Description |
|
code
|
string
|
Código de erro
|
|
message
|
string
|
Mensagem de erro indicando por que a operação falhou.
|
Errors
Objeto
A mensagem de erro associada à criação do cluster.
| Nome |
Tipo |
Description |
|
code
|
string
|
O código de erro.
|
|
message
|
string
|
A mensagem de erro.
|
ExcludedServicesConfig
Objeto
A configuração de que os serviços serão excluídos ao criar o cluster.
| Nome |
Tipo |
Description |
|
excludedServicesConfigId
|
string
|
A ID de configuração dos serviços excluídos.
|
|
excludedServicesList
|
string
|
A lista de serviços excluídos.
|
HardwareProfile
Objeto
O perfil de hardware.
| Nome |
Tipo |
Description |
|
vmSize
|
string
|
O tamanho da VM
|
HDInsightClusterProvisioningState
Enumeração
O estado de provisionamento, que aparece apenas na resposta.
| Valor |
Description |
|
InProgress
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
IPConfiguration
Objeto
As configurações de ip para o serviço de link privado.
| Nome |
Tipo |
Description |
|
id
|
string
|
A ID de configuração de IP do link privado.
|
|
name
|
string
|
O nome da configuração de IP do link privado.
|
|
properties.primary
|
boolean
|
Indica se essa configuração de IP é primária para a NIC correspondente.
|
|
properties.privateIPAddress
|
string
|
O endereço IP.
|
|
properties.privateIPAllocationMethod
|
PrivateIPAllocationMethod
|
O método em que o endereço IP privado é alocado.
|
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
O estado de provisionamento de configuração de link privado, que aparece apenas na resposta.
|
|
properties.subnet
|
ResourceId
|
A ID do recurso de sub-rede.
|
|
type
|
string
|
O tipo da configuração de IP do link privado.
|
JsonWebKeyEncryptionAlgorithm
Enumeração
Identificador de algoritmo para criptografia, RSA-OAEP padrão.
| Valor |
Description |
|
RSA-OAEP
|
|
|
RSA-OAEP-256
|
|
|
RSA1_5
|
|
KafkaRestProperties
Objeto
A configuração do proxy rest kafka que contém informações do grupo de segurança do AAD.
| Nome |
Tipo |
Description |
|
clientGroupInfo
|
ClientGroupInfo
|
As informações do grupo de segurança do AAD.
|
|
configurationOverride
|
object
|
As configurações que precisam ser substituídas.
|
LinuxOperatingSystemProfile
Objeto
O nome de usuário ssh, a senha e a chave pública ssh.
| Nome |
Tipo |
Description |
|
password
|
string
|
A senha.
|
|
sshProfile
|
SshProfile
|
O perfil SSH.
|
|
username
|
string
|
O nome de usuário.
|
NetworkProperties
Objeto
As propriedades de rede.
| Nome |
Tipo |
Description |
|
privateLink
|
PrivateLink
|
Indica se o link privado está habilitado ou não.
|
|
resourceProviderConnection
|
ResourceProviderConnection
|
A direção da conexão do provedor de recursos.
|
OsProfile
Objeto
O perfil de sistemas de operações do Linux.
OSType
Enumeração
O tipo de sistema operacional.
| Valor |
Description |
|
Windows
|
|
|
Linux
|
|
PrivateEndpoint
Objeto
O ponto de extremidade privado.
| Nome |
Tipo |
Description |
|
id
|
string
|
A ID do ponto de extremidade privado.
|
PrivateEndpointConnection
Objeto
A conexão de ponto de extremidade privado.
| Nome |
Tipo |
Description |
|
id
|
string
|
ID de recurso totalmente qualificada para o recurso. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
name
|
string
|
O nome do recurso
|
|
properties.linkIdentifier
|
string
|
O identificador de link.
|
|
properties.privateEndpoint
|
PrivateEndpoint
|
O ponto de extremidade privado da conexão de ponto de extremidade privado
|
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
O estado de conexão do serviço de link privado.
|
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
O estado de provisionamento, que aparece apenas na resposta.
|
|
systemData
|
systemData
|
Metadados relativos à criação e última modificação do recurso.
|
|
type
|
string
|
O tipo do recurso. Por exemplo, "Microsoft.Compute/virtualMachines" ou "Microsoft.Storage/storageAccounts"
|
PrivateEndpointConnectionProvisioningState
Enumeração
O estado de provisionamento, que aparece apenas na resposta.
| Valor |
Description |
|
InProgress
|
|
|
Updating
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
PrivateIPAllocationMethod
Enumeração
O método em que o endereço IP privado é alocado.
| Valor |
Description |
|
dynamic
|
|
|
static
|
|
PrivateLink
Enumeração
Indica se o link privado está habilitado ou não.
| Valor |
Description |
|
Disabled
|
|
|
Enabled
|
|
PrivateLinkConfiguration
Objeto
A configuração do link privado.
| Nome |
Tipo |
Description |
|
id
|
string
|
A ID de configuração do link privado.
|
|
name
|
string
|
O nome da configuração de link privado.
|
|
properties.groupId
|
string
|
O nome do sub-recurso vinculável privado do HDInsight ao qual aplicar a configuração de link privado. Por exemplo, 'headnode', 'gateway', 'edgenode'.
|
|
properties.ipConfigurations
|
IPConfiguration[]
|
As configurações de IP para o serviço de link privado.
|
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
O estado de provisionamento de configuração de link privado, que aparece apenas na resposta.
|
|
type
|
string
|
O tipo da configuração de link privado.
|
PrivateLinkConfigurationProvisioningState
Enumeração
O estado de provisionamento de configuração de link privado, que aparece apenas na resposta.
| Valor |
Description |
|
InProgress
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
PrivateLinkServiceConnectionState
Objeto
O estado de conexão do serviço de link privado.
| Nome |
Tipo |
Description |
|
actionsRequired
|
string
|
Se há outras ações.
|
|
description
|
string
|
A descrição opcional do status.
|
|
status
|
PrivateLinkServiceConnectionStatus
|
A conexão concreta do serviço de link privado.
|
PrivateLinkServiceConnectionStatus
Enumeração
A conexão concreta do serviço de link privado.
| Valor |
Description |
|
Approved
|
|
|
Rejected
|
|
|
Pending
|
|
|
Removed
|
|
QuotaInfo
Objeto
As propriedades de cota para o cluster.
| Nome |
Tipo |
Description |
|
coresUsed
|
integer
(int32)
|
Os núcleos usados pelo cluster.
|
ResourceId
Objeto
A ID do recurso do azure.
| Nome |
Tipo |
Description |
|
id
|
string
|
A ID do recurso do azure.
|
ResourceIdentityType
Enumeração
O tipo de identidade usado para o cluster. O tipo 'SystemAssigned, UserAssigned' inclui uma identidade criada implicitamente e um conjunto de identidades atribuídas pelo usuário.
| Valor |
Description |
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
SystemAssigned, UserAssigned
|
|
|
None
|
|
ResourceProviderConnection
Enumeração
A direção da conexão do provedor de recursos.
| Valor |
Description |
|
Inbound
|
|
|
Outbound
|
|
Role
Objeto
Descreve uma função no cluster.
| Nome |
Tipo |
Valor padrão |
Description |
|
VMGroupName
|
string
|
|
O nome do grupo de máquinas virtuais.
|
|
autoscale
|
Autoscale
|
|
As configurações de dimensionamento automático.
|
|
dataDisksGroups
|
DataDisksGroups[]
|
|
Os grupos de discos de dados para a função.
|
|
encryptDataDisks
|
boolean
|
False
|
Indica se os discos de dados são criptografados.
|
|
hardwareProfile
|
HardwareProfile
|
|
O perfil de hardware.
|
|
minInstanceCount
|
integer
(int32)
|
|
A contagem mínima de instâncias do cluster.
|
|
name
|
string
|
|
O nome da função.
|
|
osProfile
|
OsProfile
|
|
O perfil do sistema operacional.
|
|
scriptActions
|
ScriptAction[]
|
|
A lista de ações de script na função.
|
|
targetInstanceCount
|
integer
(int32)
|
|
A contagem de instâncias do cluster.
|
|
virtualNetworkProfile
|
VirtualNetworkProfile
|
|
O perfil de rede virtual.
|
ScriptAction
Objeto
Descreve uma ação de script na função no cluster.
| Nome |
Tipo |
Description |
|
name
|
string
|
O nome da ação de script.
|
|
parameters
|
string
|
Os parâmetros para o script fornecido.
|
|
uri
|
string
|
O URI para o script.
|
SecurityProfile
Objeto
O perfil de segurança que contém a chave pública SSH para o cluster HDInsight.
| Nome |
Tipo |
Description |
|
aaddsResourceId
|
string
|
A ID do recurso do Serviço de Domínio do Azure Active Directory do usuário.
|
|
clusterUsersGroupDNs
|
string[]
|
Opcional. Os Nomes Diferenciados para grupos de usuários de cluster
|
|
directoryType
|
DirectoryType
|
O tipo de diretório.
|
|
domain
|
string
|
O domínio do active directory da organização.
|
|
domainUserPassword
|
string
(password)
|
A senha do administrador de domínio.
|
|
domainUsername
|
string
|
A conta de usuário de domínio que terá privilégios de administrador no cluster.
|
|
ldapsUrls
|
string[]
|
As URLs de protocolo LDAPS para se comunicar com o Active Directory.
|
|
msiResourceId
|
string
|
Identidade atribuída pelo usuário que tem permissões para ler e criar artefatos relacionados ao cluster no AADDS do usuário.
|
|
organizationalUnitDN
|
string
|
A unidade organizacional no Active Directory para colocar o cluster e as contas de serviço.
|
SshProfile
Objeto
A lista de chaves públicas SSH.
| Nome |
Tipo |
Description |
|
publicKeys
|
SshPublicKey[]
|
A lista de chaves públicas SSH.
|
SshPublicKey
Objeto
A chave pública SSH para os nós de cluster.
| Nome |
Tipo |
Description |
|
certificateData
|
string
|
O certificado para SSH.
|
StorageAccount
Objeto
A conta de armazenamento.
| Nome |
Tipo |
Description |
|
container
|
string
|
O contêiner na conta de armazenamento, somente a ser especificado para contas de armazenamento WASB.
|
|
fileSystem
|
string
|
O sistema de arquivos, somente a ser especificado para o Azure Data Lake Storage Gen 2.
|
|
fileshare
|
string
|
O nome do compartilhamento de arquivo.
|
|
isDefault
|
boolean
|
Se a conta de armazenamento é ou não a conta de armazenamento padrão.
|
|
key
|
string
|
A chave de acesso da conta de armazenamento.
|
|
msiResourceId
|
string
|
A MSI (identidade gerenciada) que tem permissão para acessar a conta de armazenamento, somente para ser especificada para o Azure Data Lake Storage Gen 2.
|
|
name
|
string
|
O nome da conta de armazenamento.
|
|
resourceId
|
string
|
A ID do recurso da conta de armazenamento, a ser especificada apenas para o Azure Data Lake Storage Gen 2.
|
|
saskey
|
string
|
A chave de assinatura de acesso compartilhado.
|
StorageProfile
Objeto
O perfil de armazenamento.
| Nome |
Tipo |
Description |
|
storageaccounts
|
StorageAccount[]
|
A lista de contas de armazenamento no cluster.
|
systemData
Objeto
Metadados relativos à criação e última modificação do recurso.
| Nome |
Tipo |
Description |
|
createdAt
|
string
(date-time)
|
O carimbo de data/hora da criação de recursos (UTC).
|
|
createdBy
|
string
|
A identidade que criou o recurso.
|
|
createdByType
|
createdByType
|
O tipo de identidade que criou o recurso.
|
|
lastModifiedAt
|
string
(date-time)
|
O carimbo de data/hora da última modificação do recurso (UTC)
|
|
lastModifiedBy
|
string
|
A identidade que modificou o recurso pela última vez.
|
|
lastModifiedByType
|
createdByType
|
O tipo de identidade que modificou o recurso pela última vez.
|
Tier
Enumeração
A camada de cluster.
| Valor |
Description |
|
Standard
|
|
|
Premium
|
|
UserAssignedIdentity
Objeto
A identidade atribuída pelo usuário
| Nome |
Tipo |
Description |
|
clientId
|
string
|
A ID do cliente da identidade atribuída pelo usuário.
|
|
principalId
|
string
|
A ID principal da identidade atribuída pelo usuário.
|
|
tenantId
|
string
|
A ID do locatário da identidade atribuída pelo usuário.
|
VirtualNetworkProfile
Objeto
As propriedades da rede virtual.
| Nome |
Tipo |
Description |
|
id
|
string
|
A ID da rede virtual.
|
|
subnet
|
string
|
O nome da sub-rede.
|