none
Authentication thru Azure API

    Question

  • Hi,

    I am using Azure API's in C# code and used below libraries

        using Microsoft.Rest; using Microsoft.Rest.Azure.Authentication;    
        using Microsoft.Azure.Management.DataLake.Store;    
        using Microsoft.Azure.Management.DataLake.StoreUploader;    
        using Microsoft.Azure.Management.DataLake.Analytics;    
        using Microsoft.Azure.Management.DataLake.Analytics.Models;    
        using Microsoft.WindowsAzure.Storage.Blob;

    To create connection with Azure,

            private static ServiceClientCredentials AuthenticateAzure(string domainName, string nativeClientAppCLIENTID)
            {
                // User login via interactive popup
                SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
                // Use the client ID of an existing AAD "Native Client" application.
                var activeDirectoryClientSettings = ActiveDirectoryClientSettings.UsePromptOnly(nativeClientAppCLIENTID, new Uri("urn:ietf:wg:oauth:2.0:oob"));
                return UserTokenProvider.LoginWithPromptAsync(domainName, activeDirectoryClientSettings).Result;
            }

    Through this I got a popup, which ask my credentials. I don't want this pop-up appears every time. Is there any way to come up with this thing beside creating Azure app?


    • Edited by aj8102 Wednesday, December 21, 2016 12:00 PM
    Wednesday, December 21, 2016 11:05 AM

All replies

  • You can use ActiveDirectoryClientSettings.UseCacheOrCookiesOnly(nativeClientAppCLIENTID, new Uri("urn:ietf:wg:oauth:2.0:oob")); for subsequent connections. If this is for non-interactive app, you should use service-to-service client secret or a certificate. HTH.

    Jason Chen, Windows Azure PM

    Thursday, December 22, 2016 6:55 PM