Skip to content

Use Existing Resources seems to ignore existing resources  #354

@TedGoesslingMN

Description

@TedGoesslingMN

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions