示例#1
0
        /// <summary>
        /// Create cluster create parameters for ADLS Gen1 relevant tests.
        /// </summary>
        /// <param name="commonData"></param>
        /// <param name="createParams">
        /// If provided, the method will update the given parameters;
        /// Otherwise, a new create parameters will be created.
        /// </param>
        /// <returns></returns>
        public static ClusterCreateParametersExtended PrepareClusterCreateParamsForADLSv1(this CommonTestFixture commonData, ClusterCreateParametersExtended createParams = null)
        {
            var    createParamsForADLSv1 = createParams ?? commonData.PrepareClusterCreateParams();
            var    configurations        = (Dictionary <string, Dictionary <string, string> >)createParamsForADLSv1.Properties.ClusterDefinition.Configurations;
            string clusterIdentity       = "clusterIdentity";
            var    clusterIdentityConfig = new Dictionary <string, string>()
            {
                { "clusterIdentity.applicationId", commonData.DataLakeClientId },
                { "clusterIdentity.certificate", commonData.CertContent },
                { "clusterIdentity.aadTenantId", "https://login.windows.net/" + commonData.TenantId },
                { "clusterIdentity.resourceUri", "https://datalake.azure.net/" },
                { "clusterIdentity.certificatePassword", commonData.CertPassword }
            };

            configurations.Add(clusterIdentity, clusterIdentityConfig);
            bool isDefault = !createParamsForADLSv1.Properties.StorageProfile.Storageaccounts.Any();

            if (isDefault)
            {
                string coreSite   = "core-site";
                var    coreConfig = new Dictionary <string, string>()
                {
                    { "fs.defaultFS", "adl://home" },
                    { "dfs.adls.home.hostname", commonData.DataLakeStoreAccountName + ".azuredatalakestore.net" },
                    { "dfs.adls.home.mountpoint", commonData.DataLakeStoreMountpoint }
                };

                configurations.Add(coreSite, coreConfig);
            }

            return(createParamsForADLSv1);
        }
示例#2
0
        /// <summary>
        /// Create cluster create parameters for ADLS Gen2 relevant tests
        /// </summary>
        /// <param name="commonData"></param>
        /// <param name="storageAccountName"></param>
        /// <param name="storageResourceId"></param>
        /// <param name="msiResourceId"></param>
        /// <param name="createParams"></param>
        /// <returns></returns>
        public static ClusterCreateParametersExtended PrepareClusterCreateParamsForADLSv2(
            this CommonTestFixture commonData,
            string storageAccountName,
            string storageResourceId,
            string msiResourceId,
            ClusterCreateParametersExtended createParams = null)
        {
            var  createParamsForADLSv2 = createParams ?? commonData.PrepareClusterCreateParams();
            bool isDefault             = !createParamsForADLSv2.Properties.StorageProfile.Storageaccounts.Any();

            createParamsForADLSv2.Properties.StorageProfile.Storageaccounts.Add(
                new HDInsightStorageAccount
            {
                Name          = storageAccountName + commonData.DfsEndpointSuffix,
                IsDefault     = isDefault,
                FileSystem    = commonData.ContainerName.ToLowerInvariant(),
                ResourceId    = storageResourceId,
                MsiResourceId = msiResourceId
            }
                );

            var identity = new ClusterIdentity
            {
                Type = ResourceIdentityType.UserAssigned,
                UserAssignedIdentities = new Dictionary <string, ClusterIdentityUserAssignedIdentitiesValue>
                {
                    { msiResourceId, new ClusterIdentityUserAssignedIdentitiesValue() }
                }
            };

            if (createParamsForADLSv2.Identity == null)
            {
                createParamsForADLSv2.Identity = identity;
            }
            else
            {
                // At this point, only user-assigned managed identity is supported by HDInsight.
                // So identity type is not checked.
                createParamsForADLSv2.Identity.UserAssignedIdentities.Union(identity.UserAssignedIdentities);
            }

            return(createParamsForADLSv2);
        }
示例#3
0
 /// <summary>
 /// Create cluster create parameters for WASB relevant tests.
 /// </summary>
 /// <param name="commonData"></param>
 /// <returns></returns>
 public static ClusterCreateParametersExtended PrepareClusterCreateParamsForWasb(this CommonTestFixture commonData)
 {
     return(commonData.PrepareClusterCreateParams(commonData.StorageAccountName, commonData.StorageAccountKey));
 }