-
Notifications
You must be signed in to change notification settings - Fork 3k
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
WARNING: No connection string, account key or sas token found #12242
Comments
I have the same error today. The last successful deployment was on Friday 14/02/2020, and today it failed with an error message:
Update: a workaround found by jason-johnson/azure-pipelines-tasks-terraform#106 (comment) |
Hi @Demeleo and @honeykatrina, the warning information is by design, because the credentials for such command should be provided by users. Although CLI can query the credentials for users but when there are very large calls it will break storage resource provider. In this way, we show up such kind of warning message and will make credentials required in the future. To solve your problem, you need to provide one of the following credentials for such command: account key, sas token, connetion-string or auth-mode. For example, |
The Terraform CLI task in Azure DevOps pipelines that we are using doesn't propose to specify any credentials except a key. So it is not possible to pass sas token, connetion-string or auth-mode that causes the pipeline to fail. |
I do not think this is an issue with the Azure CLI necessarily but, more how the TerraformCLI task interprets failure. The azure cli writes warnings to stderr but still returns exit code 0. The task interprets the existence of text in std err as a failure regardless of the exit code. This will be resolved in the task itself by factoring in the exit code returned by the azure cli to determine if the command was successful or not. If its by design that warnings are represented in stderr while maintaining zero exit code, then i think this can be closed. |
FYI, the TerraformCLI extension will no longer fail under the condition above as of 0.4.21. |
In this way, you can use account key in your commands. Please let me know if your problem can be solved with account key provided. |
Please don't write warnings to stderr (at least unless that's in a major version increment as it should be considered a breaking change). stderr should just be for errors :) |
I have an Azure CLI task used to generate the SAS token and in subsequent steps using the SAS token, I used to access my private storage accounts. Now, this warning message is breaking my Azure CLI task. |
If you pass |
Please provide your account key or use
|
Hi @Juliehzl, I guess my point is that the You commented above with this:
But, that's not what the warning says (that I deliberately didn't want to add an account key in this instance because I'm using it in a script to teach people how to use the Azure CLI so I'm trying to keep things simple and not introduce more concepts than needed. If I use |
@robdmoore You're definitely right!! For There are two ways in discussion for your scenario:
|
Awesome! Thanks. That sounds great. |
Getting the same busted message and its nothing to do with Terraform. Its an Azure CLI task running Azure CLI commands in a Powershell script...using the vmimage 'windows-latest' from Microsoft Hosted Agents....
Returns back with...
This is my script...its been working for months.
Is a fix or workaround coming please? EDIT: OK I found that by adding --auth-mode login to each of the "az storage blob service-properties" commands it passes |
I'm seeing this issue with the az cli (2.5.1), except it throws the error, then it just goes through and works like it did before (v 2.0 of the cli) and uses the MSI. BUT, if I add --auth-mode login, then it just fails with:
There's no |
|
To block the warning message, you can add |
In addition, warning message is refined in PR #13963 |
this is nowhere near resolved.
simply put, the contributor role that allows #1 to succeed does not allow #2 to succeed (because it needs the special SA role) and there is no way in a pipeline to assign the IAM permissions for the SA role without giving the pipeline OWNER access over the subscription. what did I miss? |
@charleszipp with reference to: #12242 (comment) I get this in version 0.5.12
|
Describe the bug
I have old and new release pipelines failing on a Terraform CLI task for Command init.
deployment of state resources task YAML:
variables:
environment: 'test'
steps:
displayName: 'Release deployment state resources'
inputs:
azureSubscription: 'subscriptiondetials removed'
resourceGroupName: '$(names.prefix)-$(names.project)-deploy-rg'
location: '$(locations.primary)'
csmFile: '$(System.DefaultWorkingDirectory)\Resources$(paths.targets.publish.resources)\storage_account.template.json'
csmParametersFile: '$(System.DefaultWorkingDirectory)\Resources$(paths.targets.publish.resources)\storage_account.parameters.json'
overrideParameters: '-storage_account_name "deploymentstate" -storage_account_location "$(locations.primary)" -storage_account_tag_department "$(tags.department)" -storage_account_tag_environment "$(environment)" -storage_account_tag_project "$(tags.project) Deployment" -storage_account_tag_owner "$(tags.owner)" -storage_account_tag_resource "Storage Account"'
Terraform initialise task YAML:
variables:
environment: 'test'
steps:
displayName: 'Terraform : initialize'
inputs:
command: init
workingDirectory: '$(System.DefaultWorkingDirectory)\Resources\publish\resources'
backendType: azurerm
backendServiceArm: 'subscription'
ensureBackend: true
backendAzureRmResourceGroupName: 'project-description-deploy-resource-group'
backendAzureRmResourceGroupLocation: '$(locations.primary)'
backendAzureRmStorageAccountName: 'deploystorageaccount'
backendAzureRmContainerName: deploymentstate
backendAzureRmKey: 'teststate'
here is the log for the failed task
2020-02-18T09:17:31.8884457Z ##[section]Starting: Terraform : initialize
2020-02-18T09:17:31.8972618Z ==============================================================================
2020-02-18T09:17:31.8972744Z Task : Terraform CLI
2020-02-18T09:17:31.8972798Z Description : Execute terraform cli commands
2020-02-18T09:17:31.8972868Z Version : 0.4.19
2020-02-18T09:17:31.8972914Z Author : Charles Zipp
2020-02-18T09:17:31.8972980Z Help :
2020-02-18T09:17:31.8973040Z ==============================================================================
2020-02-18T09:17:32.5471249Z [command]C:\hostedtoolcache\windows\terraform\0.12.20\x64\terraform.exe version
2020-02-18T09:17:33.1308681Z Terraform v0.12.20
2020-02-18T09:17:33.1529307Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --service-principal -t *** -u *** -p "
2020-02-18T09:18:02.1665395Z [
2020-02-18T09:18:02.1665916Z {
2020-02-18T09:18:02.1666106Z "cloudName": "AzureCloud",
2020-02-18T09:18:02.1666354Z "id": "removes id",
2020-02-18T09:18:02.1666541Z "isDefault": true,
2020-02-18T09:18:02.1666728Z "name": "removed subscribername",
2020-02-18T09:18:02.1666880Z "state": "Enabled",
2020-02-18T09:18:02.1667160Z "tenantId": "",
2020-02-18T09:18:02.1667321Z "user": {
2020-02-18T09:18:02.1667502Z "name": "***",
2020-02-18T09:18:02.1667659Z "type": "servicePrincipal"
2020-02-18T09:18:02.1667825Z }
2020-02-18T09:18:02.1667968Z }
2020-02-18T09:18:02.1668126Z ]
2020-02-18T09:18:02.1896913Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account set -s **"
2020-02-18T09:18:03.5257527Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" group create --name -content-deploy-rg --location northeurope"
2020-02-18T09:18:06.1804023Z {
2020-02-18T09:18:06.1804643Z "id": "//resourceGroups/-content-deploy-rg",
2020-02-18T09:18:06.1804919Z "location": "northeurope",
2020-02-18T09:18:06.1805902Z "managedBy": null,
2020-02-18T09:18:06.1806101Z "name": "-content-deploy-rg",
2020-02-18T09:18:06.1806271Z "properties": {
2020-02-18T09:18:06.1806450Z "provisioningState": "Succeeded"
2020-02-18T09:18:06.1806613Z },
2020-02-18T09:18:06.1806787Z "tags": null,
2020-02-18T09:18:06.1806953Z "type": "Microsoft.Resources/resourceGroups"
2020-02-18T09:18:06.1807130Z }
2020-02-18T09:18:06.1994065Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" storage account show --name contentdeploysa --resource-group ****-****content-deploy-rg"
2020-02-18T09:18:09.6260977Z {
2020-02-18T09:18:09.6261175Z "accessTier": "Hot",
2020-02-18T09:18:09.6261243Z "azureFilesIdentityBasedAuthentication": null,
2020-02-18T09:18:09.6261331Z "creationTime": "2020-02-18T09:16:53.240309+00:00",
2020-02-18T09:18:09.6261431Z "customDomain": null,
2020-02-18T09:18:09.6261488Z "enableHttpsTrafficOnly": true,
2020-02-18T09:18:09.6261584Z "encryption": {
2020-02-18T09:18:09.6261643Z "keySource": "Microsoft.Storage",
2020-02-18T09:18:09.6261722Z "keyVaultProperties": null,
2020-02-18T09:18:09.6261784Z "services": {
2020-02-18T09:18:09.6261852Z "blob": {
2020-02-18T09:18:09.6261908Z "enabled": true,
2020-02-18T09:18:09.6261979Z "keyType": "Account",
2020-02-18T09:18:09.6262048Z "lastEnabledTime": "2020-02-18T09:16:53.318413+00:00"
2020-02-18T09:18:09.6262130Z },
2020-02-18T09:18:09.6262184Z "file": {
2020-02-18T09:18:09.6262240Z "enabled": true,
2020-02-18T09:18:09.6262311Z "keyType": "Account",
2020-02-18T09:18:09.6262380Z "lastEnabledTime": "2020-02-18T09:16:53.318413+00:00"
2020-02-18T09:18:09.6262459Z },
2020-02-18T09:18:09.6262512Z "queue": null,
2020-02-18T09:18:09.6264556Z "table": null
2020-02-18T09:18:09.6264611Z }
2020-02-18T09:18:09.6264677Z },
2020-02-18T09:18:09.6264746Z "failoverInProgress": null,
2020-02-18T09:18:09.6264821Z "geoReplicationStats": null,
2020-02-18T09:18:09.6265090Z "id": "/***8/resourceGroups/-****content-deploy-rg/providers/Microsoft.Storage/storageAccounts/",
2020-02-18T09:18:09.6265201Z "identity": null,
2020-02-18T09:18:09.6265258Z "isHnsEnabled": null,
2020-02-18T09:18:09.6265314Z "kind": "StorageV2",
2020-02-18T09:18:09.6265387Z "largeFileSharesState": null,
2020-02-18T09:18:09.6265449Z "lastGeoFailoverTime": null,
2020-02-18T09:18:09.6265523Z "location": "northeurope",
2020-02-18T09:18:09.6265585Z "name": "********contentdeploysa",
2020-02-18T09:18:09.6265668Z "networkRuleSet": {
2020-02-18T09:18:09.6265725Z "bypass": "AzureServices",
2020-02-18T09:18:09.6265799Z "defaultAction": "Allow",
2020-02-18T09:18:09.6265866Z "ipRules": [],
2020-02-18T09:18:09.6265936Z "virtualNetworkRules": []
2020-02-18T09:18:09.6266003Z },
2020-02-18T09:18:09.6266057Z "primaryEndpoints": {
2020-02-18T09:18:09.6266140Z "blob": "https://********contentdeploysa.blob.core.windows.net/",
2020-02-18T09:18:09.6266224Z "dfs": "https://********contentdeploysa.dfs.core.windows.net/",
2020-02-18T09:18:09.6266320Z "file": "https://********contentdeploysa.file.core.windows.net/",
2020-02-18T09:18:09.6266389Z "internetEndpoints": null,
2020-02-18T09:18:09.6266465Z "microsoftEndpoints": null,
2020-02-18T09:18:09.6266540Z "queue": "https://********contentdeploysa.queue.core.windows.net/",
2020-02-18T09:18:09.6266637Z "table": "https://********contentdeploysa.table.core.windows.net/",
2020-02-18T09:18:09.6266721Z "web": "https://********contentdeploysa.z16.web.core.windows.net/"
2020-02-18T09:18:09.6266800Z },
2020-02-18T09:18:09.6266857Z "primaryLocation": "northeurope",
2020-02-18T09:18:09.6266944Z "privateEndpointConnections": [],
2020-02-18T09:18:09.6267008Z "provisioningState": "Succeeded",
2020-02-18T09:18:09.6267230Z "resourceGroup": "-****content-deploy-rg",
2020-02-18T09:18:09.6267299Z "routingPreference": null,
2020-02-18T09:18:09.6267372Z "secondaryEndpoints": {
2020-02-18T09:18:09.6267447Z "blob": "https://********contentdeploysa-secondary.blob.core.windows.net/",
2020-02-18T09:18:09.6267538Z "dfs": "https://********contentdeploysa-secondary.dfs.core.windows.net/",
2020-02-18T09:18:09.6267623Z "file": null,
2020-02-18T09:18:09.6267679Z "internetEndpoints": null,
2020-02-18T09:18:09.6267755Z "microsoftEndpoints": null,
2020-02-18T09:18:09.6267835Z "queue": "https://********contentdeploysa-secondary.queue.core.windows.net/",
2020-02-18T09:18:09.6267939Z "table": "https://********contentdeploysa-secondary.table.core.windows.net/",
2020-02-18T09:18:09.6268029Z "web": "https://**contentdeploysa-secondary.z16.web.core.windows.net/"
2020-02-18T09:18:09.6268119Z },
2020-02-18T09:18:09.6268177Z "secondaryLocation": "westeurope",
2020-02-18T09:18:09.6268260Z "sku": {
2020-02-18T09:18:09.6268318Z "name": "Standard_RAGRS",
2020-02-18T09:18:09.6268393Z "tier": "Standard"
2020-02-18T09:18:09.6268448Z },
2020-02-18T09:18:09.6268517Z "statusOfPrimary": "available",
2020-02-18T09:18:09.6268582Z "statusOfSecondary": "available",
2020-02-18T09:18:09.6268644Z "tags": {
2020-02-18T09:18:09.6268713Z "Department": "Umkhosi",
2020-02-18T09:18:09.6268774Z "Environment": "test",
2020-02-18T09:18:09.6268845Z "Owner": "",
2020-02-18T09:18:09.6268909Z "Project": "****content Deployment",
2020-02-18T09:18:09.6268989Z "Resource": "Storage Account"
2020-02-18T09:18:09.6269048Z },
2020-02-18T09:18:09.6269119Z "type": "Microsoft.Storage/storageAccounts"
2020-02-18T09:18:09.6269181Z }
2020-02-18T09:18:09.6433516Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" storage container create --name contentapideploymentstate --account-name ********contentdeploysa"
2020-02-18T09:18:12.5041524Z {
2020-02-18T09:18:12.5042073Z "created": true
2020-02-18T09:18:12.5042261Z }
2020-02-18T09:18:12.5043052Z WARNING: No connection string, account key or sas token found, we will query account keys for your storage account. Please try to use --auth-mode login or provide one of the following parameters: connection string, account key or sas token for your storage account.
2020-02-18T09:18:12.5113066Z ##[error]Error: WARNING: No connection string, account key or sas token found, we will query account keys for your storage account. Please try to use --auth-mode login or provide one of the following parameters: connection string, account key or sas token for your storage account.
2020-02-18T09:18:12.8541515Z ##[section]Finishing: Terraform : initialize
To Reproduce
Create terraform release pipeline. after a task to deploy state resource follow procedure to create normal terraform release pipeline
Expected behavior
Expect terraform to create all resources in Azure
Environment summary
Create terraform release pipeline. after a task to deploy state resource follow procedure to create normal terraform release pipeline. YAML files show above
Additional context
can this be related to this #12193 ?
The text was updated successfully, but these errors were encountered: