2017-07-12 39 views

回答

1

如果您想以不登錄形式登錄安靜,解決方案:

string _username = <your azure username> 
    string _pass = <your azure password> 
    string _adlsAccountName = <name of your data lake store> 
    string _subId = <your subscription id> 
    string localFolderPath = @"<yourfolderpath>" 
    string localFilePath = Path.Combine(localFolderPath, "<yourFile>"); 
    string remoteFolderPath = "/path on data lake/"; 
    string remoteFilePath = Path.Combine(remoteFolderPath, "yourFileonDataLake"); 

var tenantId = "<your tenant id>"; //you can find this in right top corner on azure portal 
var nativeClientApp_clientId = "1950a258-227b-4e31-a9cf-717495945fc2"; // you can use this one 
var activeDirectoryClientSettings = ActiveDirectoryClientSettings.UsePromptOnly(nativeClientApp_clientId, new Uri("urn:ietf:wg:oauth:2.0:oob")); 
var creds = UserTokenProvider.LoginSilentAsync(nativeClientApp_clientId, tenantId, _username, _password).Result; 
_adlsClient = new DataLakeStoreAccountManagementClient(creds) { SubscriptionId = _subId }; 
_adlsFileSystemClient = new DataLakeStoreFileSystemManagementClient(creds); 

如果u希望有日誌形式的數據湖僅使用LoginWithPromptAsyncMethod從UserTokenProvider。

這是設置。現在你可以使用_adlsFileSystemClient的上傳,追加等。希望這會幫助某人。

相關問題