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.
This commit is contained in:
Carlos Nunez 2017-11-18 15:44:10 -06:00 committed by GitHub
parent e9a63d8653
commit a8ff095059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 29 deletions

View File

@ -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 <<EOF
> {
> "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'
```