예제 #1
0
        private ServiceClientCredentials GetAccountCredentials(AdlsInfo adlsInfo)
        {
            SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
            var domain           = adlsInfo.AadDomain;
            var webAppClientId   = adlsInfo.AadClient;
            var clientSecret     = adlsInfo.AadClientSecret;
            var clientCredential = new ClientCredential(webAppClientId, clientSecret);

            return(ApplicationTokenProvider.LoginSilentAsync(domain, clientCredential).Result);
        }
예제 #2
0
        public AdlsHelper(IActivityLogger logger, AdlsInfo adlsInfo)
        {
            _logger   = logger;
            _adlsName = adlsInfo.AdlsName;
            var creds = GetAccountCredentials(adlsInfo);

            _adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(creds);

            var adlsAccountManagementClient = new DataLakeStoreAccountManagementClient(creds)
            {
                SubscriptionId = adlsInfo.AzureSubscriptionId
            };

            adlsAccountManagementClient.Account.List();
        }
예제 #3
0
        private void LogAzureDataLakeStoreInfo(AzureDataLakeStoreDataset adlsDataSet, AdlsInfo adlsInfo, IActivityLogger logger)
        {
            logger.Write("\n******** Data Lake Store info ********");
            logger.Write("\nName       : " + adlsInfo.AdlsName);
            logger.Write("\nUri        : " + adlsInfo.AdlsUri);
            logger.Write("\nDomain     : " + adlsInfo.AadDomain);
            logger.Write("\nClient     : " + adlsInfo.AadClient);
            logger.Write("\nClientKey  : " + (string.IsNullOrWhiteSpace(adlsInfo.AadClientSecret) ? "<No value!>" : "********"));
            logger.Write("\nAuthorization : " + (string.IsNullOrWhiteSpace(adlsInfo.AdlsAuthorization) ? "<No value!>" : "********"));
            logger.Write("\nResource Group: " + adlsInfo.AdlsResourceGroupName);
            logger.Write("\nSubscription  : " + (string.IsNullOrWhiteSpace(adlsInfo.AzureSubscriptionId) ? "<No value!>" : "********"));
            logger.Write("\nSessionId     : " + adlsInfo.AdlsSessionId);

            logger.Write("\nData folder: " + adlsDataSet.FolderPath);
            logger.Write("\nData format: " + adlsDataSet.Format);

            var partitions = adlsDataSet.PartitionedBy?.Count ?? 0;

            logger.Write($"\nPartitions ({partitions}):");
            for (int i = 0; i < partitions; i++)
            {
                var val = (DateTimePartitionValue)adlsDataSet.PartitionedBy?[i]?.Value;

                logger.Write(
                    $"\n\t{adlsDataSet.PartitionedBy?[i]?.Name ?? "null"}: {val?.Date} ({val?.Format})");
            }

            logger.Write("\nBlob file: " + adlsDataSet.FileName);

            if (adlsDataSet.FolderPath.IndexOf("/", StringComparison.InvariantCulture) <= 0)
            {
                throw new Exception($"Can't find container name for dataset '{adlsDataSet.FolderPath}'");
            }

            logger.Write("\nFolder path: {0}", adlsDataSet.FolderPath);
        }