# Local-exec using powershell not executing Az command

**URL:** <https://discuss.hashicorp.com/t/local-exec-using-powershell-not-executing-az-command/33046>\
**Category:** Azure\
**Created:** [December 10, 2021, 7:43pm UTC](https://discuss.hashicorp.com/t/local-exec-using-powershell-not-executing-az-command/33046 "2021-12-10T19:43:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MWOITC](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mwoitc/32/11349_2.png) [@MWOITC](https://discuss.hashicorp.com/u/MWOITC)\
**Post date:** [December 10, 2021, 7:43pm UTC](https://discuss.hashicorp.com/t/local-exec-using-powershell-not-executing-az-command/33046/1 "2021-12-10T19:43:46Z")

</div>

Having some issues when trying to run Powershell commands through a null-resource 'local-exec". I’m tryin trying to run a PowerShell command with some additional parameters:

provisioner “local-exec” {  
interpreter = [“PowerShell”, “-Command”]  
command = \<\<EOT  
ResourceGroupName = '"{module.rg.resource\_group.name}"’  
FunctionAppName = '"{var.functionapp.name}"’  
SubscriptionId = "{var.subscriptions.id}"

```
  # Option 1 - does nothing
  Get-AzFunctionApp -ResourceGroupName $ResourceGroupName -Name $FunctionAppName -SubscriptionId $SubscriptionId
  
  # Option 2 - does nothing
  (Get-AzFunctionApp -ResourceGroupName $ResourceGroupName -Name $FunctionAppName -SubscriptionId $SubscriptionId)
  
  # Option 3 - shows the correct cmd line with correctly expanded variables but does not execute the command
  "Get-AzFunctionApp -ResourceGroupName $ResourceGroupName -Name $FunctionAppName -SubscriptionId $SubscriptionId"
  
  # Option 4 - when I hardcode the values it works
  Get-AzFunctionApp -ResourceGroupName "real_rg_name" -Name "real_rg_appname" -SubscriptionId real_subscr_id
EOT

```

}

Only when I hardcode the values the Az command executes.
