azure-search-openai-demo
azure-search-openai-demo copied to clipboard
Use Existing Resources seems to ignore existing resources
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
- [ x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
Try to follow the instructions for using existing resources while working for an organization that has required polices for resource group and resource naming and tagging. Pre-create and tag the resource group and all resources listed in infra/main.parameters.json so that they conform to your organization's rules. Use the "azd env set" command to specify the resource group and resources you pre-created. Run the "azd up" command. See that your pre-created resource group was ignored as the script tries to create a new resource group starting with "rg-" (a name that is not allowed by your organizations policies). See that the script fails because it ignores the "azd env set" parameters you provided and tries to create a new resource group and resources that are not allowed by your organization policies.
Any log messages given by the failure
{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.","details":[{"code":"InvalidPolicyParameters","message":"A function or parameter in policy assignment 'g46pnamingrgpol02' associated with the policy definition 'g46pnamingrgpol02' could not be validated. Please either fix the policy or remove the policy assignment to unblock. If using template functions, try following the tips in: https://aka.ms/policy-avoiding-template-failures. The inner error is 'Unable to evaluate the template language function 'substring'. The index parameter cannot be less than zero. The index: '-3'. Please see https://aka.ms/arm-template-expressions/#substring for usage details.'."}]}
Expected/desired behavior
Provide clearer instructions (for novices like me!) on the resource group and resources that must already existing if you plan to use "azd env set" to build with existing resources. Ensure that the script works correctly when called after using "azd env set" for the resource group and resources that were pre-created.
OS and Version?
GitHub Codepaces
azd version?
azd version 1.0.2 (commit 145e046b1ea9394bd4e1b1d539eb32e860d692fb)
Versions
Mention any other details that might be useful
I'm new to this sort of work, so if I've missed something obvious, thanks in advance for your help!
Thanks! We'll be in touch soon.
Can you provide more details on what changes you've made to bicep or bicep params file?
I have not made any changes to bicep or the bicep params file. I only read the params file as a guide for trying to understand what resource group and resources need exist if I planned to use the azd set env command. I simply pre-created the resource group and resources. Then I ran the following commands before running azd up: azd env set AZURE_OPENAI_RESOURCE_GROUP g46d-openai-rg-001 azd env set AZURE_OPENAI_SERVICE g46d-taiga-cog-001 azd env set AZURE_STORAGE_RESOURCE_GROUP g46d-openai-rg-001 azd env set AZURE_STORAGE_ACCOUNT g46dtaigast01 azd env set AZURE_SEARCH_SERVICE_RESOURCE_GROUP g46d-openai-rg-001 azd env set AZURE_SEARCH_SERVICE g46d-taiga-srch-001 azd env set AZURE_FORMRECOGNIZER_RESOURCE_GROUP g46d-openai-rg-001 azd env set AZURE_FORMRECOGNIZER_SERVICE g46d-taiga-srch-001 azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT TAIGA-gpt-36-turbo azd env set AZURE_OPENAI_GPT_DEPLOYMENT TAIGA-davinci-003
I'm a newbie at this, so I was just guessing that I needed to specify all these parameters. Please correct me if I'm wrong.
I have since deleted the specified ChatGPT and GPT deployments because I thought that might be the issue.
I got the same issue. any solution?
No, I haven't had any additional response.
Same issue for me
Please use resourceGroup bicep template. It will resolve the issue.
You'll also need to specify the parameters that you want to reuse in the main.parameters.json file.
You can see an example here: https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/infra/main.parameters.json#L23
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this issue will be closed.