Bicep deployment failes with error "New-AzManagementGroupDeployment : 9:35:38 am - Error: Code=; Message='deploymentName' does not match expected pattern '^[-\w\._\(\)]+$'"

Peter Kutter 11 Reputation points
2022-10-27T20:47:49.097+00:00

Hi,

trying to create a role assignment at the management level using Bicep and PowerShell to deploy.
When I run with what-if switch it succeeds with no errors. However if I remove the switch it fails with following error.

--------------

New-AzManagementGroupDeployment : 9:35:38 am - Error: Code=; Message='deploymentName' does not match expected pattern '^[-\w._()]+$'.

------------------

I haven't specified a name. Even tried using the -Name switch but same result.
Not sure what else I can look at.

thanks,
Peter

Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
725 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Peter Kutter 11 Reputation points
    2022-11-01T22:15:47.697+00:00

    Hi managed to fix it by using the -Name switch for New-AzManagementGroupDeployment. Had to make up a name that is unique.
    Thought if you don't specify a name, it auto generates one using a time stamp but, in this case, did not work.