AzureRMR (version 1.0.0)

get_azure_token: Generate an Azure OAuth token

Description

This extends the OAuth functionality in httr to allow for device code authentication.

Usage

get_azure_token(aad_host, tenant, app,
  auth_type = c("client_credentials", "device_code"), password,
  resource_host)

Arguments

aad_host

URL for your Azure Active Directory host. For the public Azure cloud, this is https://login.microsoftonline.com/.

tenant

Your tenant ID.

app

Your client/app ID which you registered in AAD.

auth_type

The authentication type, either "client_credentials" or "device_code".

password

Your password. Required for auth_type == "client_credentials", ignored for auth_type == "device_code".

resource_host

URL for your resource host. For Resource Manager in the public Azure cloud, this is https://management.azure.com/.

Details

This function does much the same thing as httr::oauth2.0_token(), but with support for device authentication and with unnecessary options removed. Device authentication removes the need to save a password on your machine. Instead, the server provides you with a code, along with a URL. You then visit the URL in your browser and enter the code, which completes the authentication process.

See Also

AzureToken, httr::oauth2.0_token, httr::Token, OAuth authentication for Azure Active Directory, Device code flow on OAuth.com

Examples

Run this code
# NOT RUN {
token <- get_azure_token(
   aad_host="https://login.microsoftonline.com/",
   tenant="myaadtenant.onmicrosoft.com",
   app="app_id",
   password="password",
   resource_host="https://management.azure.com/")

# }

Run the code above in your browser using DataLab