0

I would like to deploy simple bicep for deploying Azure Storage. But I'm getting strange errors.

Could it be that there is compatibility issues on Az or powershell? What commands solve the issue.

New-AzResourceGroupDeployment -TemplateFile main.bicep

New-AzResourceGroupDeployment -TemplateFile main.bicep
New-AzResourceGroupDeployment : Unexpected character encountered while parsing value: r. Path '', line 0, position 0.
+ New-AzResourceGroupDeployment -TemplateFile main.bicep

get-installedModule -Name Az

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
3.7.0      Az                                  PSGallery            Microsoft Azure PowerShell - Cmdlets to manage resources in Azu... 

az version

{
  "azure-cli": "2.4.0",
  "azure-cli-command-modules-nspkg": "2.0.3",
  "azure-cli-core": "2.4.0",
  "azure-cli-nspkg": "3.0.4",
  "azure-cli-telemetry": "1.0.4",
  "extensions": {}
}

I tried also CLI on command line, but got error:

az deployment group create --resource-group kensbicep-rg --template-file main.bicep
Expecting value: line 1 column 1 (char 0)
Kenny_I
  • 2,001
  • 5
  • 40
  • 94
  • 1
    Have you checked a similar issue on GitHub? [New-AzResourceGroupDeployment : Unexpected character encountered while parsing value: @. Path](https://github.com/Azure/bicep/discussions/3140) – Ecstasy Dec 09 '21 at 12:11
  • 1
    You can check [Troubleshoot Bicep file deployments](https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/quickstart-troubleshoot-bicep-deployment?tabs=azure-cli) – Ecstasy Dec 09 '21 at 12:16
  • I upgraded CLI and CLI for Bicep works. I did not get powershell work. – Kenny_I Dec 09 '21 at 14:13

1 Answers1

0

Run the commands below since it is likely that your PowerShell and Bicep are running different versions. Likely, PowerShell is older. Update using the commands below.

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force -AllowClobber
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

More information can be found on the following page: https://learn.microsoft.com/en-us/answers/questions/521002/bicep-deployment-failing-on-certain-environments-n.html

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77