none
Documentation for Microsoft.Azure.Management.Scheduler SDK RRS feed

  • Question

  • I am trying to figure out how to use the latest Azure Scheduler SDK (Microsoft.Azure.Management.Scheduler v2.2.0).

    In Nuget, the project URL directs me to the Github repo for the Azure SDK for .NET and there appears to be no documentation on how to actually use the SDK. What information is there appears to be for the older SDKs from when Microsoft Azure was called Windows Azure.

    There's a lot of documentation available for the older SDK, Microsoft.WindowsAzure.Management.Scheduler, however it was last updated in 2015 and I would prefer to use the more recent SDK.

    Google/Bing searches, Stack Overflow, and various blogs all have info on using the older SDK, but I haven't run across any for the newer one.

    Since the Scheduler API is rather straight forward, not a lot of documentation is needed since it's pretty discoverable, however how do I create the credentials object SchedulerManagementClient uses? It takes an ServiceClientCredentials object, however it's abstract and can't be initialized. It's not obvious to me what compatible class I should use.

    I did eventually get it working using some sample code from the Azure Management Fluent API:

    public static ServiceClientCredentials GetCredentials()
    {
        var authContext = new AuthenticationContext(string.Format("https://login.windows.net/{0}", Settings.Azure.TenantId));
        var credential = new ClientCredential(Settings.Azure.ClientId, Settings.Azure.ClientSecret);
        AuthenticationResult authenticationResult = authContext.AcquireTokenAsync("https://management.core.windows.net/", credential).Result;
    
        if (authenticationResult == null)
        {
            throw new Exception("Failed to obtain the token");
        }
    
        string token = authenticationResult.CreateAuthorizationHeader().Substring("Bearer ".Length);
    
        ServiceClientCredentials credentials = new TokenCredentials(token);
    
        return credentials;
    }
    


    Since the fluent API doesn't yet support the Azure Scheduler it was pure happenstance that I even discovered it.

    Tuesday, May 30, 2017 8:09 PM

All replies