Skip to content

Instantly share code, notes, and snippets.

@mosesrenegade
Last active February 10, 2021 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mosesrenegade/b2f49b0d5af2c5d733cba8bf4557fed5 to your computer and use it in GitHub Desktop.
Save mosesrenegade/b2f49b0d5af2c5d733cba8bf4557fed5 to your computer and use it in GitHub Desktop.
{
"info": {
"_postman_id": "c0baae3a-0c9e-92f1-04fd-a27c315c5956",
"name": "Azure REST",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Get AAD Token",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(pm.info.requestName, () => {",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody('error');",
"});",
"pm.globals.set(\"bearerToken\", pm.response.json().access_token);"
]
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/x-www-form-urlencoded"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "client_credentials",
"type": "text"
},
{
"key": "client_id",
"value": "{{clientId}}",
"type": "text"
},
{
"key": "client_secret",
"value": "{{clientSecret}}",
"type": "text"
},
{
"key": "resource",
"value": "{{resource}}",
"type": "text"
}
]
},
"url": "https://login.microsoftonline.com/{{tenantId}}/oauth2/token"
},
"response": []
},
{
"name": "Get Resource Groups",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{bearerToken}}"
}
],
"body": {
"mode": "formdata",
"formdata": []
},
"url": {
"raw": "https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups?api-version=2017-05-10",
"protocol": "https",
"host": [
"management",
"azure",
"com"
],
"path": [
"subscriptions",
"{{subscriptionId}}",
"resourcegroups"
],
"query": [
{
"key": "api-version",
"value": "2017-05-10"
}
]
}
},
"response": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment