Tworzy nowy klaster usługi HDInsight z określonymi parametrami.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}?api-version=2021-06-01
Parametry identyfikatora URI
| Nazwa |
W |
Wymagane |
Typ |
Opis |
|
clusterName
|
path |
True
|
string
|
Nazwa klastra.
|
|
resourceGroupName
|
path |
True
|
string
|
Nazwa grupy zasobów.
|
|
subscriptionId
|
path |
True
|
string
|
Poświadczenia subskrypcji, które jednoznacznie identyfikują subskrypcję platformy Microsoft Azure. Identyfikator subskrypcji stanowi część identyfikatora URI dla każdego wywołania usługi.
|
|
api-version
|
query |
True
|
string
|
Wersja interfejsu API klienta usługi HDInsight.
|
Treść żądania
| Nazwa |
Typ |
Opis |
|
identity
|
ClusterIdentity
|
Tożsamość klastra, jeśli jest skonfigurowana.
|
|
location
|
string
|
Lokalizacja klastra.
|
|
properties
|
ClusterCreateProperties
|
Klaster tworzy parametry.
|
|
tags
|
object
|
Tagi zasobów.
|
|
zones
|
string[]
|
Strefy dostępności.
|
Odpowiedzi
| Nazwa |
Typ |
Opis |
|
200 OK
|
Cluster
|
Definicja odpowiedzi OK.
|
|
Other Status Codes
|
ErrorResponse
|
Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.
|
Zabezpieczenia
azure_auth
Przepływ protokołu OAuth2 usługi Azure Active Directory
Typ:
oauth2
Flow:
implicit
Adres URL autoryzacji:
https://login.microsoftonline.com/common/oauth2/authorize
Zakresy
| Nazwa |
Opis |
|
user_impersonation
|
personifikacja konta użytkownika
|
Przykłady
Create cluster with availability zones
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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
Przykładowe żądanie
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
Przykładowa odpowiedź
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"
}
}
Definicje
| Nazwa |
Opis |
|
Autoscale
|
Parametry żądania automatycznego skalowania
|
|
AutoscaleCapacity
|
Parametry żądania automatycznego skalowania opartego na obciążeniu
|
|
AutoscaleRecurrence
|
Parametry żądania automatycznego skalowania opartego na harmonogramie
|
|
AutoscaleSchedule
|
Parametry reguły automatycznego skalowania opartego na harmonogramie składającej się z tablicy dni + czasu i pojemności
|
|
AutoscaleTimeAndCapacity
|
Parametry żądania czasu i pojemności
|
|
ClientGroupInfo
|
Informacje o grupie zabezpieczeń usługi AAD.
|
|
Cluster
|
Klaster usługi HDInsight.
|
|
ClusterCreateParametersExtended
|
Parametry żądania CreateCluster.
|
|
ClusterCreateProperties
|
Klaster tworzy parametry.
|
|
ClusterDefinition
|
Definicja klastra.
|
|
ClusterGetProperties
|
Właściwości klastra.
|
|
ClusterIdentity
|
Tożsamość klastra.
|
|
ComputeIsolationProperties
|
Właściwości izolacji obliczeniowej.
|
|
ComputeProfile
|
Opisuje profil obliczeniowy.
|
|
ConnectivityEndpoint
|
Właściwości łączności
|
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
|
DataDisksGroups
|
Dyski danych grup dla roli.
|
|
DaysOfWeek
|
Dni tygodnia dla reguły automatycznego skalowania opartego na harmonogramie
|
|
DirectoryType
|
Typ katalogu.
|
|
DiskEncryptionProperties
|
Właściwości szyfrowania dysku
|
|
EncryptionInTransitProperties
|
Właściwości szyfrowania podczas przesyłania.
|
|
ErrorResponse
|
Opisuje format odpowiedzi Błąd.
|
|
Errors
|
Komunikat o błędzie skojarzony z tworzeniem klastra.
|
|
ExcludedServicesConfig
|
Konfiguracja, która będzie wykluczana podczas tworzenia klastra.
|
|
HardwareProfile
|
Profil sprzętu.
|
|
HDInsightClusterProvisioningState
|
Stan aprowizacji, który pojawia się tylko w odpowiedzi.
|
|
IPConfiguration
|
Konfiguracje adresów IP dla usługi private link.
|
|
JsonWebKeyEncryptionAlgorithm
|
Identyfikator algorytmu szyfrowania, domyślny RSA-OAEP.
|
|
KafkaRestProperties
|
Konfiguracja serwera proxy rest platformy Kafka zawierająca informacje o grupie zabezpieczeń usługi AAD.
|
|
LinuxOperatingSystemProfile
|
Nazwa użytkownika, hasło i klucz publiczny SSH.
|
|
NetworkProperties
|
Właściwości sieci.
|
|
OsProfile
|
Profil systemów operacyjnych Linux.
|
|
OSType
|
Typ systemu operacyjnego.
|
|
PrivateEndpoint
|
Prywatny punkt końcowy.
|
|
PrivateEndpointConnection
|
Połączenie prywatnego punktu końcowego.
|
|
PrivateEndpointConnectionProvisioningState
|
Stan aprowizacji, który pojawia się tylko w odpowiedzi.
|
|
PrivateIPAllocationMethod
|
Metoda przydzielania prywatnego adresu IP.
|
|
PrivateLink
|
Wskazuje, czy łącze prywatne jest włączone.
|
|
PrivateLinkConfiguration
|
Konfiguracja łącza prywatnego.
|
|
PrivateLinkConfigurationProvisioningState
|
Stan aprowizacji konfiguracji łącza prywatnego, który pojawia się tylko w odpowiedzi.
|
|
PrivateLinkServiceConnectionState
|
Stan połączenia usługi łącza prywatnego.
|
|
PrivateLinkServiceConnectionStatus
|
Konkretne połączenie usługi private link.
|
|
QuotaInfo
|
Właściwości przydziału klastra.
|
|
ResourceId
|
Identyfikator zasobu platformy Azure.
|
|
ResourceIdentityType
|
Typ tożsamości używanej dla klastra. Typ "SystemAssigned, UserAssigned" zawiera zarówno niejawnie utworzoną tożsamość, jak i zestaw tożsamości przypisanych przez użytkownika.
|
|
ResourceProviderConnection
|
Kierunek połączenia dostawcy zasobów.
|
|
Role
|
Opisuje rolę w klastrze.
|
|
ScriptAction
|
Opisuje akcję skryptu dla roli w klastrze.
|
|
SecurityProfile
|
Profil zabezpieczeń zawierający klucz publiczny Ssh dla klastra usługi HDInsight.
|
|
SshProfile
|
Lista kluczy publicznych SSH.
|
|
SshPublicKey
|
Klucz publiczny SSH dla węzłów klastra.
|
|
StorageAccount
|
Konto magazynu.
|
|
StorageProfile
|
Profil magazynu.
|
|
systemData
|
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
|
|
Tier
|
Warstwa klastra.
|
|
UserAssignedIdentity
|
Tożsamość przypisana przez użytkownika
|
|
VirtualNetworkProfile
|
Właściwości sieci wirtualnej.
|
Autoscale
Objekt
Parametry żądania automatycznego skalowania
| Nazwa |
Typ |
Opis |
|
capacity
|
AutoscaleCapacity
|
Parametry skalowania automatycznego opartego na obciążeniu
|
|
recurrence
|
AutoscaleRecurrence
|
Parametry skalowania automatycznego opartego na harmonogramie
|
AutoscaleCapacity
Objekt
Parametry żądania automatycznego skalowania opartego na obciążeniu
| Nazwa |
Typ |
Opis |
|
maxInstanceCount
|
integer
(int32)
|
Maksymalna liczba wystąpień klastra
|
|
minInstanceCount
|
integer
(int32)
|
Minimalna liczba wystąpień klastra
|
AutoscaleRecurrence
Objekt
Parametry żądania automatycznego skalowania opartego na harmonogramie
| Nazwa |
Typ |
Opis |
|
schedule
|
AutoscaleSchedule[]
|
Tablica reguł automatycznego skalowania opartego na harmonogramie
|
|
timeZone
|
string
|
Strefa czasowa dla harmonogramów automatycznego skalowania
|
AutoscaleSchedule
Objekt
Parametry reguły automatycznego skalowania opartego na harmonogramie składającej się z tablicy dni + czasu i pojemności
| Nazwa |
Typ |
Opis |
|
days
|
DaysOfWeek[]
|
Dni tygodnia dla reguły automatycznego skalowania opartego na harmonogramie
|
|
timeAndCapacity
|
AutoscaleTimeAndCapacity
|
Czas i pojemność reguły automatycznego skalowania opartego na harmonogramie
|
AutoscaleTimeAndCapacity
Objekt
Parametry żądania czasu i pojemności
| Nazwa |
Typ |
Opis |
|
maxInstanceCount
|
integer
(int32)
|
Maksymalna liczba wystąpień klastra
|
|
minInstanceCount
|
integer
(int32)
|
Minimalna liczba wystąpień klastra
|
|
time
|
string
|
24-godzinny czas w postaci xx:xx
|
ClientGroupInfo
Objekt
Informacje o grupie zabezpieczeń usługi AAD.
| Nazwa |
Typ |
Opis |
|
groupId
|
string
|
Identyfikator grupy zabezpieczeń usługi AAD.
|
|
groupName
|
string
|
Nazwa grupy zabezpieczeń usługi AAD.
|
Cluster
Objekt
Klaster usługi HDInsight.
| Nazwa |
Typ |
Opis |
|
etag
|
string
|
Element ETag zasobu
|
|
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Przykład - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
identity
|
ClusterIdentity
|
Tożsamość klastra, jeśli jest skonfigurowana.
|
|
location
|
string
|
Lokalizacja geograficzna, w której znajduje się zasób
|
|
name
|
string
|
Nazwa zasobu
|
|
properties
|
ClusterGetProperties
|
Właściwości klastra.
|
|
systemData
|
systemData
|
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
|
|
tags
|
object
|
Tagi zasobów.
|
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
|
zones
|
string[]
|
Strefy dostępności.
|
ClusterCreateParametersExtended
Objekt
Parametry żądania CreateCluster.
| Nazwa |
Typ |
Opis |
|
identity
|
ClusterIdentity
|
Tożsamość klastra, jeśli jest skonfigurowana.
|
|
location
|
string
|
Lokalizacja klastra.
|
|
properties
|
ClusterCreateProperties
|
Klaster tworzy parametry.
|
|
tags
|
object
|
Tagi zasobów.
|
|
zones
|
string[]
|
Strefy dostępności.
|
ClusterCreateProperties
Objekt
Klaster tworzy parametry.
ClusterDefinition
Objekt
Definicja klastra.
| Nazwa |
Typ |
Opis |
|
blueprint
|
string
|
Link do strategii.
|
|
componentVersion
|
object
|
Wersje różnych usług w klastrze.
|
|
configurations
|
object
|
Konfiguracje klastra.
|
|
kind
|
string
|
Typ klastra.
|
ClusterGetProperties
Objekt
Właściwości klastra.
ClusterIdentity
Objekt
Tożsamość klastra.
| Nazwa |
Typ |
Opis |
|
principalId
|
string
|
Identyfikator podmiotu zabezpieczeń tożsamości klastra. Ta właściwość zostanie udostępniona tylko dla tożsamości przypisanej przez system.
|
|
tenantId
|
string
|
Identyfikator dzierżawy skojarzony z klastrem. Ta właściwość zostanie udostępniona tylko dla tożsamości przypisanej przez system.
|
|
type
|
ResourceIdentityType
|
Typ tożsamości używanej dla klastra. Typ "SystemAssigned, UserAssigned" zawiera zarówno niejawnie utworzoną tożsamość, jak i zestaw tożsamości przypisanych przez użytkownika.
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
Lista tożsamości użytkowników skojarzonych z klastrem. Odwołania do klucza słownika tożsamości użytkownika będą identyfikatorami zasobów arm w postaci: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}".
|
ComputeIsolationProperties
Objekt
Właściwości izolacji obliczeniowej.
| Nazwa |
Typ |
Domyślna wartość |
Opis |
|
enableComputeIsolation
|
boolean
|
False
|
Flaga wskazuje, czy włączyć izolację obliczeniową, czy nie.
|
|
hostSku
|
string
|
|
Jednostka SKU hosta.
|
ComputeProfile
Objekt
Opisuje profil obliczeniowy.
| Nazwa |
Typ |
Opis |
|
roles
|
Role[]
|
Lista ról w klastrze.
|
ConnectivityEndpoint
Objekt
Właściwości łączności
| Nazwa |
Typ |
Opis |
|
location
|
string
|
Lokalizacja punktu końcowego.
|
|
name
|
string
|
Nazwa punktu końcowego.
|
|
port
|
integer
(int32)
|
Port do nawiązania połączenia.
|
|
privateIPAddress
|
string
|
Prywatny adres IP punktu końcowego.
|
|
protocol
|
string
|
Protokół punktu końcowego.
|
createdByType
Wyliczanie
Typ tożsamości, która utworzyła zasób.
| Wartość |
Opis |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
DataDisksGroups
Objekt
Dyski danych grup dla roli.
| Nazwa |
Typ |
Opis |
|
diskSizeGB
|
integer
(int32)
|
Tylko do odczytu. Rozmiar dysku w GB. Nie ustawiaj tej wartości.
|
|
disksPerNode
|
integer
(int32)
|
Liczba dysków na węzeł.
|
|
storageAccountType
|
string
|
Tylko do odczytu. Typ konta magazynu. Nie ustawiaj tej wartości.
|
DaysOfWeek
Wyliczanie
Dni tygodnia dla reguły automatycznego skalowania opartego na harmonogramie
| Wartość |
Opis |
|
Monday
|
|
|
Tuesday
|
|
|
Wednesday
|
|
|
Thursday
|
|
|
Friday
|
|
|
Saturday
|
|
|
Sunday
|
|
DirectoryType
Wyliczanie
Typ katalogu.
| Wartość |
Opis |
|
ActiveDirectory
|
|
DiskEncryptionProperties
Objekt
Właściwości szyfrowania dysku
| Nazwa |
Typ |
Domyślna wartość |
Opis |
|
encryptionAlgorithm
|
JsonWebKeyEncryptionAlgorithm
|
|
Identyfikator algorytmu szyfrowania, domyślny RSA-OAEP.
|
|
encryptionAtHost
|
boolean
|
False
|
Wskazuje, czy szyfrowanie dysków zasobów jest włączone.
|
|
keyName
|
string
|
|
Nazwa klucza używana do włączania szyfrowania dysków.
|
|
keyVersion
|
string
|
|
Określona wersja klucza używana do włączania szyfrowania dysków.
|
|
msiResourceId
|
string
|
|
Identyfikator zasobu tożsamości zarządzanej używany do uzyskiwania dostępu do magazynu kluczy.
|
|
vaultUri
|
string
|
|
Podstawowy identyfikator URI magazynu kluczy, w którym znajduje się klucz klienta, np. https://myvault.vault.azure.net
|
EncryptionInTransitProperties
Objekt
Właściwości szyfrowania podczas przesyłania.
| Nazwa |
Typ |
Domyślna wartość |
Opis |
|
isEncryptionInTransitEnabled
|
boolean
|
False
|
Wskazuje, czy komunikacja między węzłami klastra jest szyfrowana podczas przesyłania.
|
ErrorResponse
Objekt
Opisuje format odpowiedzi Błąd.
| Nazwa |
Typ |
Opis |
|
code
|
string
|
Kod błędu
|
|
message
|
string
|
Komunikat o błędzie wskazujący, dlaczego operacja nie powiodła się.
|
Errors
Objekt
Komunikat o błędzie skojarzony z tworzeniem klastra.
| Nazwa |
Typ |
Opis |
|
code
|
string
|
Kod błędu.
|
|
message
|
string
|
Komunikat o błędzie.
|
ExcludedServicesConfig
Objekt
Konfiguracja, która będzie wykluczana podczas tworzenia klastra.
| Nazwa |
Typ |
Opis |
|
excludedServicesConfigId
|
string
|
Identyfikator konfiguracji wykluczonych usług.
|
|
excludedServicesList
|
string
|
Lista wykluczonych usług.
|
HardwareProfile
Objekt
Profil sprzętu.
| Nazwa |
Typ |
Opis |
|
vmSize
|
string
|
Rozmiar maszyny wirtualnej
|
HDInsightClusterProvisioningState
Wyliczanie
Stan aprowizacji, który pojawia się tylko w odpowiedzi.
| Wartość |
Opis |
|
InProgress
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
IPConfiguration
Objekt
Konfiguracje adresów IP dla usługi private link.
| Nazwa |
Typ |
Opis |
|
id
|
string
|
Identyfikator konfiguracji adresu IP łącza prywatnego.
|
|
name
|
string
|
Nazwa konfiguracji adresu IP łącza prywatnego.
|
|
properties.primary
|
boolean
|
Wskazuje, czy ta konfiguracja adresu IP jest podstawowa dla odpowiedniej karty sieciowej.
|
|
properties.privateIPAddress
|
string
|
Adres IP.
|
|
properties.privateIPAllocationMethod
|
PrivateIPAllocationMethod
|
Metoda przydzielania prywatnego adresu IP.
|
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
Stan aprowizacji konfiguracji łącza prywatnego, który pojawia się tylko w odpowiedzi.
|
|
properties.subnet
|
ResourceId
|
Identyfikator zasobu podsieci.
|
|
type
|
string
|
Typ konfiguracji adresu IP łącza prywatnego.
|
JsonWebKeyEncryptionAlgorithm
Wyliczanie
Identyfikator algorytmu szyfrowania, domyślny RSA-OAEP.
| Wartość |
Opis |
|
RSA-OAEP
|
|
|
RSA-OAEP-256
|
|
|
RSA1_5
|
|
KafkaRestProperties
Objekt
Konfiguracja serwera proxy rest platformy Kafka zawierająca informacje o grupie zabezpieczeń usługi AAD.
| Nazwa |
Typ |
Opis |
|
clientGroupInfo
|
ClientGroupInfo
|
Informacje o grupie zabezpieczeń usługi AAD.
|
|
configurationOverride
|
object
|
Konfiguracje, które muszą zostać zastąpione.
|
LinuxOperatingSystemProfile
Objekt
Nazwa użytkownika, hasło i klucz publiczny SSH.
| Nazwa |
Typ |
Opis |
|
password
|
string
|
Hasło.
|
|
sshProfile
|
SshProfile
|
Profil SSH.
|
|
username
|
string
|
Nazwa użytkownika.
|
NetworkProperties
Objekt
Właściwości sieci.
OsProfile
Objekt
Profil systemów operacyjnych Linux.
OSType
Wyliczanie
Typ systemu operacyjnego.
| Wartość |
Opis |
|
Windows
|
|
|
Linux
|
|
PrivateEndpoint
Objekt
Prywatny punkt końcowy.
| Nazwa |
Typ |
Opis |
|
id
|
string
|
Identyfikator prywatnego punktu końcowego.
|
PrivateEndpointConnection
Objekt
Połączenie prywatnego punktu końcowego.
| Nazwa |
Typ |
Opis |
|
id
|
string
|
W pełni kwalifikowany identyfikator zasobu dla zasobu. Przykład - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
name
|
string
|
Nazwa zasobu
|
|
properties.linkIdentifier
|
string
|
Identyfikator łącza.
|
|
properties.privateEndpoint
|
PrivateEndpoint
|
Prywatny punkt końcowy połączenia prywatnego punktu końcowego
|
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
Stan połączenia usługi łącza prywatnego.
|
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
Stan aprowizacji, który pojawia się tylko w odpowiedzi.
|
|
systemData
|
systemData
|
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
|
|
type
|
string
|
Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"
|
PrivateEndpointConnectionProvisioningState
Wyliczanie
Stan aprowizacji, który pojawia się tylko w odpowiedzi.
| Wartość |
Opis |
|
InProgress
|
|
|
Updating
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
PrivateIPAllocationMethod
Wyliczanie
Metoda przydzielania prywatnego adresu IP.
| Wartość |
Opis |
|
dynamic
|
|
|
static
|
|
PrivateLink
Wyliczanie
Wskazuje, czy łącze prywatne jest włączone.
| Wartość |
Opis |
|
Disabled
|
|
|
Enabled
|
|
PrivateLinkConfiguration
Objekt
Konfiguracja łącza prywatnego.
| Nazwa |
Typ |
Opis |
|
id
|
string
|
Identyfikator konfiguracji łącza prywatnego.
|
|
name
|
string
|
Nazwa konfiguracji łącza prywatnego.
|
|
properties.groupId
|
string
|
Nazwa zasobu podrzędnego z możliwością połączenia prywatnego usługi HDInsight w celu zastosowania konfiguracji łącza prywatnego. Na przykład "headnode", "gateway", "edgenode".
|
|
properties.ipConfigurations
|
IPConfiguration[]
|
Konfiguracje adresów IP dla usługi private link.
|
|
properties.provisioningState
|
PrivateLinkConfigurationProvisioningState
|
Stan aprowizacji konfiguracji łącza prywatnego, który pojawia się tylko w odpowiedzi.
|
|
type
|
string
|
Typ konfiguracji łącza prywatnego.
|
PrivateLinkConfigurationProvisioningState
Wyliczanie
Stan aprowizacji konfiguracji łącza prywatnego, który pojawia się tylko w odpowiedzi.
| Wartość |
Opis |
|
InProgress
|
|
|
Failed
|
|
|
Succeeded
|
|
|
Canceled
|
|
|
Deleting
|
|
PrivateLinkServiceConnectionState
Objekt
Stan połączenia usługi łącza prywatnego.
| Nazwa |
Typ |
Opis |
|
actionsRequired
|
string
|
Czy istnieją dalsze działania.
|
|
description
|
string
|
Opcjonalny opis stanu.
|
|
status
|
PrivateLinkServiceConnectionStatus
|
Konkretne połączenie usługi private link.
|
PrivateLinkServiceConnectionStatus
Wyliczanie
Konkretne połączenie usługi private link.
| Wartość |
Opis |
|
Approved
|
|
|
Rejected
|
|
|
Pending
|
|
|
Removed
|
|
QuotaInfo
Objekt
Właściwości przydziału klastra.
| Nazwa |
Typ |
Opis |
|
coresUsed
|
integer
(int32)
|
Rdzenie używane przez klaster.
|
ResourceId
Objekt
Identyfikator zasobu platformy Azure.
| Nazwa |
Typ |
Opis |
|
id
|
string
|
Identyfikator zasobu platformy Azure.
|
ResourceIdentityType
Wyliczanie
Typ tożsamości używanej dla klastra. Typ "SystemAssigned, UserAssigned" zawiera zarówno niejawnie utworzoną tożsamość, jak i zestaw tożsamości przypisanych przez użytkownika.
| Wartość |
Opis |
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
SystemAssigned, UserAssigned
|
|
|
None
|
|
ResourceProviderConnection
Wyliczanie
Kierunek połączenia dostawcy zasobów.
| Wartość |
Opis |
|
Inbound
|
|
|
Outbound
|
|
Role
Objekt
Opisuje rolę w klastrze.
| Nazwa |
Typ |
Domyślna wartość |
Opis |
|
VMGroupName
|
string
|
|
Nazwa grupy maszyn wirtualnych.
|
|
autoscale
|
Autoscale
|
|
Konfiguracje automatycznego skalowania.
|
|
dataDisksGroups
|
DataDisksGroups[]
|
|
Dyski danych grup dla roli.
|
|
encryptDataDisks
|
boolean
|
False
|
Wskazuje, czy szyfrują dyski danych.
|
|
hardwareProfile
|
HardwareProfile
|
|
Profil sprzętu.
|
|
minInstanceCount
|
integer
(int32)
|
|
Minimalna liczba wystąpień klastra.
|
|
name
|
string
|
|
Nazwa roli.
|
|
osProfile
|
OsProfile
|
|
Profil systemu operacyjnego.
|
|
scriptActions
|
ScriptAction[]
|
|
Lista akcji skryptu dla roli.
|
|
targetInstanceCount
|
integer
(int32)
|
|
Liczba wystąpień klastra.
|
|
virtualNetworkProfile
|
VirtualNetworkProfile
|
|
Profil sieci wirtualnej.
|
ScriptAction
Objekt
Opisuje akcję skryptu dla roli w klastrze.
| Nazwa |
Typ |
Opis |
|
name
|
string
|
Nazwa akcji skryptu.
|
|
parameters
|
string
|
Parametry podanego skryptu.
|
|
uri
|
string
|
Identyfikator URI skryptu.
|
SecurityProfile
Objekt
Profil zabezpieczeń zawierający klucz publiczny Ssh dla klastra usługi HDInsight.
| Nazwa |
Typ |
Opis |
|
aaddsResourceId
|
string
|
Identyfikator zasobu usługi Azure Active Directory Domain Service użytkownika.
|
|
clusterUsersGroupDNs
|
string[]
|
Opcjonalny. Nazwy wyróżniające dla grup użytkowników klastra
|
|
directoryType
|
DirectoryType
|
Typ katalogu.
|
|
domain
|
string
|
Domena usługi Active Directory organizacji.
|
|
domainUserPassword
|
string
(password)
|
Hasło administratora domeny.
|
|
domainUsername
|
string
|
Konto użytkownika domeny, które będzie miało uprawnienia administratora w klastrze.
|
|
ldapsUrls
|
string[]
|
Adresy URL protokołu LDAPS do komunikacji z usługą Active Directory.
|
|
msiResourceId
|
string
|
Tożsamość przypisana przez użytkownika, która ma uprawnienia do odczytywania i tworzenia artefaktów związanych z klastrem w usłudze AADDS użytkownika.
|
|
organizationalUnitDN
|
string
|
Jednostka organizacyjna w usłudze Active Directory do umieszczania klastra i kont usług.
|
SshProfile
Objekt
Lista kluczy publicznych SSH.
| Nazwa |
Typ |
Opis |
|
publicKeys
|
SshPublicKey[]
|
Lista kluczy publicznych SSH.
|
SshPublicKey
Objekt
Klucz publiczny SSH dla węzłów klastra.
| Nazwa |
Typ |
Opis |
|
certificateData
|
string
|
Certyfikat dla protokołu SSH.
|
StorageAccount
Objekt
Konto magazynu.
| Nazwa |
Typ |
Opis |
|
container
|
string
|
Kontener na koncie magazynu, który ma być określony tylko dla kont magazynu WASB.
|
|
fileSystem
|
string
|
System plików, który ma być określony tylko dla usługi Azure Data Lake Storage Gen 2.
|
|
fileshare
|
string
|
Nazwa udziału plików.
|
|
isDefault
|
boolean
|
Określa, czy konto magazynu jest domyślnym kontem magazynu.
|
|
key
|
string
|
Klucz dostępu do konta magazynu.
|
|
msiResourceId
|
string
|
Tożsamość zarządzana (MSI), która może uzyskiwać dostęp do konta magazynu, tylko dla usługi Azure Data Lake Storage Gen 2.
|
|
name
|
string
|
Nazwa konta magazynu.
|
|
resourceId
|
string
|
Identyfikator zasobu konta magazynu, który ma być określony tylko dla usługi Azure Data Lake Storage Gen 2.
|
|
saskey
|
string
|
Klucz sygnatury dostępu współdzielonego.
|
StorageProfile
Objekt
Profil magazynu.
| Nazwa |
Typ |
Opis |
|
storageaccounts
|
StorageAccount[]
|
Lista kont magazynu w klastrze.
|
systemData
Objekt
Metadane dotyczące tworzenia i ostatniej modyfikacji zasobu.
| Nazwa |
Typ |
Opis |
|
createdAt
|
string
(date-time)
|
Sygnatura czasowa tworzenia zasobu (UTC).
|
|
createdBy
|
string
|
Tożsamość, która utworzyła zasób.
|
|
createdByType
|
createdByType
|
Typ tożsamości, która utworzyła zasób.
|
|
lastModifiedAt
|
string
(date-time)
|
Znacznik czasu ostatniej modyfikacji zasobu (UTC)
|
|
lastModifiedBy
|
string
|
Tożsamość, która ostatnio zmodyfikowała zasób.
|
|
lastModifiedByType
|
createdByType
|
Typ tożsamości, która ostatnio zmodyfikowała zasób.
|
Tier
Wyliczanie
Warstwa klastra.
| Wartość |
Opis |
|
Standard
|
|
|
Premium
|
|
UserAssignedIdentity
Objekt
Tożsamość przypisana przez użytkownika
| Nazwa |
Typ |
Opis |
|
clientId
|
string
|
Identyfikator klienta tożsamości przypisanej przez użytkownika.
|
|
principalId
|
string
|
Identyfikator podmiotu zabezpieczeń tożsamości przypisanej przez użytkownika.
|
|
tenantId
|
string
|
Identyfikator dzierżawy tożsamości przypisanej przez użytkownika.
|
VirtualNetworkProfile
Objekt
Właściwości sieci wirtualnej.
| Nazwa |
Typ |
Opis |
|
id
|
string
|
Identyfikator sieci wirtualnej.
|
|
subnet
|
string
|
Nazwa podsieci.
|