azure-search-openai-demo icon indicating copy to clipboard operation
azure-search-openai-demo copied to clipboard

InvalidTemplateDeployment Reponse 400: Bad Request

Open bpccquebral opened this issue 2 years ago • 1 comments
trafficstars

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

azd up

Any log messages given by the failure

ERROR: deployment failed: failing invoking action 'provision', error deploying infrastructure: starting deployment to subscription: PUT https://management.azure.com/subscriptions/64e1b7f2-1942-45c9-abeb-53639c742966/providers/Microsoft.Resources/deployments/openaidemo-dev-1685332326


RESPONSE 400: 400 Bad Request ERROR CODE: InvalidTemplateDeployment

{ "error": { "code": "InvalidTemplateDeployment", "message": "The template deployment failed with error: 'Authorization failed for template resource 'rg-openaidemo-dev' of type 'Microsoft.Resources/resourceGroups'. The client '[email here]' with object id '9cf168c1-e2ee-43e6-aee6-09a224dfd411' does not have permission to perform action 'Microsoft.Resources/subscriptions/resourceGroups/write' at scope '/subscriptions/64e1b7f2-1942-45c9-abeb-53639c742966/resourceGroups/rg-openaidemo-dev'.'." } }

TraceID: 4d40f0939994ac5ee25474bfcbff5ffc

Expected/desired behavior

Build successful

OS and Version?

Windows 10

azd version?

1.0.1

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

bpccquebral avatar May 29 '23 03:05 bpccquebral

+1 this

szelesaron avatar Jun 20 '23 10:06 szelesaron

anyone that could fix this?

salvafuentes avatar Jul 11 '23 19:07 salvafuentes

Do you have permissions to create new resource groups? That is required for azd up to work. The error seems to suggest you don't, from my reading of it. If you can't create new resource groups, then you could try setting resourceGroupName, searchServiceResourceGroupName, storageResourceGroupName, and openAiResourceGroupName in infra/main.bicep to an existing resource group. That may work.

pamelafox avatar Jul 11 '23 22:07 pamelafox

Do you have permissions to create new resource groups? That is required for azd up to work. The error seems to suggest you don't, from my reading of it. If you can't create new resource groups, then you could try setting resourceGroupName, searchServiceResourceGroupName, storageResourceGroupName, and openAiResourceGroupName in infra/main.bicep to an existing resource group. That may work.

I've tried setting every avaliable resource with proper perms but didn't work. The obly thing that worked was having subscription level access.

szelesaron avatar Jul 12 '23 19:07 szelesaron

Do you have permissions to create new resource groups? That is required for azd up to work. The error seems to suggest you don't, from my reading of it. If you can't create new resource groups, then you could try setting resourceGroupName, searchServiceResourceGroupName, storageResourceGroupName, and openAiResourceGroupName in infra/main.bicep to an existing resource group. That may work.

Turns out that I wasn't assigned as contributor in the resource group that had the OpenAI service assigned. Once I obtained the owner permission in that specific resource group I was able to run the demo without any problems.

salvafuentes avatar Jul 12 '23 21:07 salvafuentes

I didn't have the right permission when I ran the script. After applying the recommended role, the build was successful.

bpccquebral avatar Jul 13 '23 04:07 bpccquebral