ProvisionSample/Program.cs
/// <summary>
/// Gets an Azure access token that can be used to call into the Azure ARM apis. 
/// Requires configuring a Azure AD navtive applicatino which is then configured to delegated access rights to your Azure subscription resources
/// </summary>
/// <returns></returns>
Gets an Azure access token that can be used to call into the Azure ARM apis.
Requires configuring a Azure AD navtive applicatino which is then configured to delegated access rights to your Azure subscription resources
Gets an Azure access token that can be used to call into the Azure ARM apis . Requires configuring a Azure AD navtive applicatino which is then configured to delegated access rights to your Azure subscription resources
static string GetAzureAccessToken()
        {
            var tokenCache = new TokenCache();
            var authContext = new AuthenticationContext("https://login.windows.net/common/oauth2/authorize", tokenCache);
            var result = authContext.AcquireToken(
                resource: "https://management.core.windows.net/",
                clientId: clientId,
                redirectUri: new Uri("https://login.live.com/oauth20_desktop.srf"),
                promptBehavior: PromptBehavior.RefreshSession);
            if (result == null)
            {
                throw new InvalidOperationException("Failed to obtain the JWT token");
            }
            return result.AccessToken;
        }
static string GetAzureAccessToken ( ) { var tokenCache = new TokenCache ( ) ; var authContext = new AuthenticationContext ( " " , tokenCache ) ; var result = authContext . AcquireToken ( resource : " " , clientId : clientId , redirectUri : new Uri ( " " ) , promptBehavior : PromptBehavior . RefreshSession ) ; if ( result == null ) { throw new InvalidOperationException ( " " ) ; } return result . AccessToken ; }
Gets an Azure access token that can be used to call into the Azure ARM apis.
Gets an Azure access token that can be used to call into the Azure ARM apis .
// Follow instructions here to setup your tenants provisioning app: https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/#get-access-token-in-code
None