Skip to content

Instantly share code, notes, and snippets.

@chgeuer
Created September 29, 2016 17:00
Show Gist options
  • Save chgeuer/a9c483d37e56a67d9b08c12e6cad970d to your computer and use it in GitHub Desktop.
Save chgeuer/a9c483d37e56a67d9b08c12e6cad970d to your computer and use it in GitHub Desktop.
aad_tenant_id = "f1c9b125-e2bf-48c0-b025-23e47c410293"
client_id = "1326f47c-eaea-42aa-8aa8-ff99fbaf3da9"
client_secret = "..."
aad_host = "https://login.microsoftonline.de/"
management_url = "https://management.microsoftazure.de/"
fiddler_opts = [ proxy: "http://127.0.0.1:8888", ssl_options: [ cacertfile: "/Users/chgeuer/Desktop/fiddler.cer"] ]
token = OAuth2.Client.new([
strategy: OAuth2.Strategy.ClientCredentials,
site: aad_host <> aad_tenant_id,
token_url: "/oauth2/token?api-version=1.0",
token_method: :post, client_id: client_id, client_secret: client_secret
]) |> OAuth2.Client.get_token!([ auth_scheme: "request_body", resource: management_url ], [], fiddler_opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment