Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obtainAuthorizationToken endpoint string missing #47

Open
mwk1000 opened this issue Jan 17, 2020 · 2 comments
Open

obtainAuthorizationToken endpoint string missing #47

mwk1000 opened this issue Jan 17, 2020 · 2 comments

Comments

@mwk1000
Copy link

mwk1000 commented Jan 17, 2020

Reviewing the code the endpoint is only valid for stack can you check for empty and remove the --resource from the az account command if it is empty. I believe that is causing the failures I am experiencing with a user az cli account:

az account get-access-token --resource --subscription -o=json
az account get-access-token: error: argument --resource: expected one argument
usage: az account get-access-token [-h] [--verbose] [--debug]
[--output {json,jsonc,table,tsv}]
[--query JMESPATH]
[--subscription SUBSCRIPTION]
[--resource RESOURCE]

-vs-
az account get-access-token --subscription 31deaf44-bdac-40c1-89fa-376f984921c0 -o=json
{
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InBpVmxsb1FEU01LeGgxbTJ5Z3FHU1ZkZ0ZwQSIsImtpZCI6InBpVmxsb1FEU01LeGgxbTJ5Z3FHU1ZkZ0ZwQSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC84M2IwZjVlYS02NDk5LTRlNTItODRlMS1mNTg2ZTMxOGQ4NjUvIiwiaWF0IjoxNTc5MjkzMDY2LCJuYmYiOjE1NzkyOTMwNjYsImV4cCI6MTU3OTI5Njk2NiwiYWNyIjoiMSIsImFpbyI6IjQyTmdZT2lSUEJiK2M2TFhsTmc4djQ3RE80M0RyeWhOckZubFZXUEtWOU4yYnZyWkEzOEIiLCJhbXIiOlsid2lhIl0sImFwcGlkIjoiMDRiMDc3OTUtOGRkYi00NjFhLWJiZWUtMDJmOWUxYmY3YjQ2IiwiYXBwa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JpY2tAamFja3Nvbi5jb20iLCJ1cG4iOiJtYXJrLmtpcmtwYXRyaWNrQGphY2tzb24uY29tIiwidXRpIjoiUXg2TDNPTWk0RU9Ba1FtdTcwMWNBQSIsInZlciI6IjEuMCJ9.bkMmNP6ZUw7JLy9poasWOpUL_cnOjCduR7ciFaMHCRW8oFB5anqZgBbM5FCUCXrRg84FME2fTqzxlu29qz0R5KwqDH5peYyxw3JELvMSIFxThVeUmdCVwIpJjlqUo7yr3wl0P0bRZU6jlNsktIIjICkM5drxv7rU8TBsmkmg3vIq0zg9nHZuQVi_N55iJrRJN-vrtKToygt5k68GloM9c484NQ4Ji5MQuHeftSrx2rmiWw-TBI6CgCsQea13zi1A4tlSaZ8HfqH-GMuKTN-gRDrLKXJDKtjsFB55-EV4MNwblfz1hwWS8kGDfJxEufO9dOybUbRJx-4Be16ulsUDjg",
"expiresOn": "2020-01-17 16:36:05.562116",
"subscription": "mysub",
"tenant": "myten",
"tokenType": "Bearer"
}

and the resulting:
2020-01-17T14:41:40.703-0500 [DEBUG] plugin.terraform-provider-azurerm_v1.41.0_x4: Testing if Service Principal / Client Certificate is applicable for Authentication..
2020-01-17T14:41:40.703-0500 [DEBUG] plugin.terraform-provider-azurerm_v1.41.0_x4: Testing if Multi Tenant Service Principal / Client Secret is applicable for Authentication..
2020-01-17T14:41:40.703-0500 [DEBUG] plugin.terraform-provider-azurerm_v1.41.0_x4: Testing if Service Principal / Client Secret is applicable for Authentication..
2020-01-17T14:41:40.703-0500 [DEBUG] plugin.terraform-provider-azurerm_v1.41.0_x4: Testing if Managed Service Identity is applicable for Authentication..
2020-01-17T14:41:40.703-0500 [DEBUG] plugin.terraform-provider-azurerm_v1.41.0_x4: Testing if Obtaining a token from the Azure CLI is applicable for Authentication..
2020-01-17T14:41:40.703-0500 [DEBUG] plugin.terraform-provider-azurerm_v1.41.0_x4: Using Obtaining a token from the Azure CLI for Authentication
2020/01/17 14:41:42 [ERROR] module.microazure: eval: *terraform.EvalConfigProvider, err: Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 2
2020/01/17 14:41:42 [ERROR] module.microazure: eval: *terraform.EvalSequence, err: Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 2
2020/01/17 14:41:42 [ERROR] module.microazure: eval: *terraform.EvalOpFilter, err: Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 2
2020/01/17 14:41:42 [ERROR] module.microazure: eval: *terraform.EvalSequence, err: Error building account: Error getting authenticated object ID: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 2

@mwk1000
Copy link
Author

mwk1000 commented Jan 17, 2020

Alternately I tested using empty "" as the value for --resource and that also works ( from the command line )

@mwk1000
Copy link
Author

mwk1000 commented Jan 17, 2020

2020/01/17 16:01:12 [INFO] Terraform version: 0.12.9
2020/01/17 16:01:12 [INFO] Go runtime version: go1.12.9
2020/01/17 16:01:12 [DEBUG] found provider "terraform-provider-azurerm_v1.41.0_x4" ( or 36/39...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant