From a8ff095059c1188e013be9af6a4e64c496e073bd Mon Sep 17 00:00:00 2001 From: Carlos Nunez Date: Sat, 18 Nov 2017 15:44:10 -0600 Subject: [PATCH] Generate a JSON object for Packer This changes adds code that will generate a JSON object containing the things you'll need to make Packer work with Azure. --- .../source/docs/builders/azure-setup.html.md | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/website/source/docs/builders/azure-setup.html.md b/website/source/docs/builders/azure-setup.html.md index 86522642d..618e38543 100644 --- a/website/source/docs/builders/azure-setup.html.md +++ b/website/source/docs/builders/azure-setup.html.md @@ -246,6 +246,23 @@ $ azure role list --json \ Now (finally) everything has been setup in Azure. Let's get our configuration keys together: +Python: + +```shell +$ cat < { +> "subscription_id": $(az account show | jq '.id'), +> "client_id": $(az ad app list | jq '.[] | select(.displayName == "Packer") | .appId'), +> "client_secret": "$password", +> "location": "$location", +> "tenant_id": $(az account show | jq '.tenantId') +> "object_id": $(az ad app list | jq '.[] | select(.displayName == "Packer") | .objectId') +> } +> EOF +``` + +node.js: + Get `subscription_id`: ``` shell @@ -253,12 +270,6 @@ $ azure account show --json \ | jq ".[] | .id" ``` -Python: - -```shell -$ az account show | jq -r '.id' -``` - Get `client_id` ``` shell @@ -266,11 +277,6 @@ $ azure ad app list --json \ | jq '.[] | select(.displayName | contains("APPNAME")) | .appId' ``` -Python - -```shell -$ az ad app list | jq '.[] | select(.displayName | contains("APPNAME")) | .appId' -``` Get `client_secret` @@ -282,32 +288,14 @@ Get `object_id` (OSTYpe=Windows only) azure ad sp show -n CLIENT_ID ``` -Python: - -```shell -$ az ad sp show -n CLIENT_ID -``` - Get `resource_group_name` ``` shell $ azure group list ``` -Python: - -```shell -$ az group list | jq '.[] | select(.name=="GROUPNAME") | .id' -``` - Get `storage_account` ``` shell $ azure storage account list ``` - -Python: - -```shell -$ az storage account list | jq '.[] | select(.name=="GROUPNAME") | .id' -```