title: How to set command output as env. variable in windows cmd?
body: <p>I have saved azure storage key in key vault and i want to retrieve the key using Azure cli and set it as env. variable in window cmd before i run terraform script.</p>
  
  <p>Below listed command doesn't work, can anyone tell me what needs to be changed ?</p>
  
  <pre><code>set ARM_ACCESS_KEY=$(az keyvault secret show --name terraform-backend-key --vault-name myKeyVault)
  </code></pre>
  
  <p>Error on initializing</p>
  
  <p><a href="https://i.stack.imgur.com/xH0K4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xH0K4.png" alt="enter image description here"></a></p>
  
  <p>Main.tf</p>
  
  <pre><code>variable "count" {}
  variable "prefix" {
  default="RG"
   }
  terraform {
  backend "azurerm" {
  container_name       = "new"
  storage_account_name  = "mfarg"
  key                  = "terraform.tfstate"
  }}
  resource "azurerm_resource_group" "test" {
  count ="${var.count}"
  name     = "${var.prefix}-${count.index}"
  location = "West US 2"
  }
  </code></pre>
  
  <p>Command prompt output</p>
  
  <p><a href="https://i.stack.imgur.com/QfcH1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QfcH1.png" alt="enter image description here"></a></p>