title: Running Azure AZ login command with Terraform
body: <p>Issue:
  I am trying to execute a bash script in Terraform and its throwing an error</p>
  <p>Environment: I am running Terraform in VScode (terminal is bash) on Windows 10.
  I've also tried running in standard git bash command terminal and it throws same error.
  I've also tried replacing 'program = [&quot;bash&quot;,' with 'program = [&quot;az&quot;,' but still throws error.</p>
  <p>my bash script</p>
  <pre><code>#!/bin/bash
  
  # Exit if any of the intermediate steps fail
  set -e
  
  # Login
  az login --service-principal -u &quot;${ARM_CLIENT_ID}&quot; -p &quot;${ARM_CLIENT_SECRET}&quot; --tenant &quot;${ARM_TENANT_ID}&quot; &gt;/dev/null
  
  # Extract the query json into variables
  eval &quot;$(jq -r '@sh &quot;SUBSCRIPTION_NAME=\(.subscription_name)&quot;')&quot;
  
  # Get the subscription id and pass back map
  az account list --query &quot;[?name == '${SUBSCRIPTION_NAME}'].id | {id: join(', ', @)}&quot; --output json
  </code></pre>
  <p>my main.tf file</p>
  <pre><code>locals {
      access_levels     = [&quot;read&quot;, &quot;write&quot;]
      subscription_name = lower(var.subscription_name)
  }
  
  # lookup existing subscription
  data &quot;azurerm_subscription&quot; &quot;current&quot; {}
  
  # Lookup Subscription
  data &quot;external&quot; &quot;lookupByName&quot; {
    # Looks up a subscription by its display name and returns id
    program = [&quot;bash&quot;, &quot;${path.module}/scripts/lookupByName.sh&quot;]
  
    query = {
      subscription_name = local.subscription_name
    }
  }
  </code></pre>
  <p>throws error after running 'terraform plan'</p>
  <pre><code>The refreshed state will be used to calculate this plan, but will not be
  persisted to local or remote state storage.
  
  data.external.lookupByName: Refreshing state...
  data.azurerm_subscription.current: Refreshing state...
  
  Error: failed to execute &quot;bash&quot;: usage: az login [-h] [--verbose] [--debug] [--only-show-errors]
                  [--output {json,jsonc,yaml,yamlc,table,tsv,none}]
                  [--query JMESPATH] [--username USERNAME] [--password PASSWORD]
                  [--service-principal] [--tenant TENANT]
                  [--allow-no-subscriptions] [-i] [--use-device-code]
                  [--use-cert-sn-issuer]
  az login: error: Expecting value: line 1 column 1 (char 0)
  
  
    on main.tf line 10, in data &quot;external&quot; &quot;lookupByName&quot;:
    10: data &quot;external&quot; &quot;lookupByName&quot; {
  </code></pre>