From 50c2cdcf04cc900b857ab2069184e4668b4ba3f6 Mon Sep 17 00:00:00 2001 From: kkuzmin Date: Thu, 5 Oct 2017 19:35:00 +0100 Subject: [PATCH] Amend creation of AL key section. (#23) (#24) * Amend creation of AL key section. * Fix wording. * Address comments * Address comments. * Change example username * Address comments * Fix quotes --- README.md | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 16bb6b0..252fcdf 100644 --- a/README.md +++ b/README.md @@ -48,37 +48,36 @@ blade itself. ## Create an Alert Logic Access Key -Login and get an authentication token from the Alert Logic Cloud Insight product [AIMS API](https://console.product.dev.alertlogic.com/api/aims/). From the command line use [curl](https://en.wikipedia.org/wiki/CURL) as follows (where `` is your CloudInsight user and `` is your CloudInsight password): - -``` -curl -X POST -v -u ':' https://api.global-services.global.alertlogic.com/aims/v1/authenticate -``` - -Make a note of the following fields returned in the response: - - * USER ID - * ACCOUNT ID - * TOKEN - -Use the authentication token returned in the response to create access keys for the Azure application deployed in the next section. Issue the following curl command (where `` is the auth token, `` is the account ID, and `` is the user ID returned above): - +From the Bash command line in [Azure Cloud Shell](https://docs.microsoft.com/en-us/azure/cloud-shell/quickstart) run the following commands, where `` is your Alert Logic user and `` is your Alert Logic password: ``` -curl -X POST -H "x-aims-auth-token: " https://api.global-services.global.alertlogic.com/aims/v1//users//access_keys +export AL_USERNAME='' +export AL_PASSWORD='' +auth=$(curl -X POST -s -u $AL_USERNAME:$AL_PASSWORD https://api.global-services.global.alertlogic.com/aims/v1/authenticate); export AL_ACCOUNT_ID=$(echo $auth | jq -r '.authentication.account.id'); export AL_USER_ID=$(echo $auth | jq -r '.authentication.user.id'); export AL_TOKEN=$(echo $auth | jq -r '.authentication.token'); [ -z $AL_TOKEN ] && echo "Authentication failure"; unset AL_USERNAME; unset AL_PASSWORD; curl -s -X POST -H "x-aims-auth-token: $AL_TOKEN" https://api.global-services.global.alertlogic.com/aims/v1/$AL_ACCOUNT_ID/users/$AL_USER_ID/access_keys | jq ``` - An example of a successful response is: ``` -{"access_key_id":"8bb72b92eb43f0bb","secret_key":"15b74g7fe32b9a0083172b724fa8b84aebfa9325bba2b3bc8933216013e220c1"} +{ + "access_key_id": "712c0b413eef41f6", + "secret_key": "1234567890b3eea8880d292fb31aa96902242a076d3d0e320cc036eb51bf25ad" +} ``` +**Note:** if the output is blank please double-check the Alert Logic user permission, you should have administrator access. More details about AIMS APIs can be found [here](https://console.product.dev.alertlogic.com/api/aims/). + Make a note of the `access_key_id` and `secret_key` values for use in the deployment steps below. **Note:** Only five access keys can be created per user. If you get a "limit exceeded" response you will need to -delete some keys in order to create new ones. Use the following command to delete access keys: +delete some keys in order to create new ones. Use the following command to list access keys: + +``` +curl -s -X GET -H "x-aims-auth-token: $AL_TOKEN" https://api.global-services.global.alertlogic.com/aims/v1/$AL_ACCOUNT_ID/users/$AL_USER_ID/access_keys | jq +``` +Then use the selected access_key_id in the following curl command to delete it: ``` -curl -X DELETE -H "x-aims-auth-token: " https://api.global-services.global.alertlogic.com/aims/v1//users//access_keys/ + +curl -X DELETE -H "x-aims-auth-token: $AL_TOKEN" https://api.global-services.global.alertlogic.com/aims/v1/$AL_ACCOUNT_ID/users/$AL_USER_ID/access_keys/ ``` ## Function deployment