Created
August 5, 2017 05:47
-
-
Save ramnov/cd00b19b6a94373e77ba2c7269a40995 to your computer and use it in GitHub Desktop.
R script to obtain Azure Active Directory Token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(jsonlite) | |
library(curl) | |
h <- new_handle() | |
handle_setform(h, | |
"grant_type"="client_credentials", | |
"resource"="https://management.core.windows.net/", | |
"client_id"="<CLIENT ID>", | |
"client_secret"="<CLIENT SECRET>" | |
) | |
req <- curl_fetch_memory("https://login.windows.net/<TENANT ID>/oauth2/token", handle = h) | |
res <- fromJSON(rawToChar(req$content)) | |
res$access_token |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment