Azure / Azure/bicep

Reference existing resource via a full resource string

Open
#3,173 3 comments 4 reactions 0 assignees View on GitHub
revisit
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
[`Microsoft.Network/loadBalancers`](https://docs.microsoft.com/en-us/azure/templates/microsoft.network/loadbalancers/backendaddresspools?tabs=json) provides the full resource ID in its type `backendAddressPools[0].properties.backendIPConfigurations[0].id`:

![image](https://user-images.githubusercontent.com/37585349/121654731-51be4680-ca9e-11eb-8540-38f594f7e192.png)

Two questions arise:

1. How in Bicep we can reference the existing resource based on the full resource ID?

2. Given the full resource ID I'd like to reference only the VMSS. Is there a way to extract only a part of resource ID, or, based on a full resource ID do `.parent.parent...` to get to the desired resource?
```json
{
"id": "/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachineScaleSets//virtualMachines/0/networkInterfaces//ipConfigurations/"
},
```

**Describe the solution you'd like**
Most likely this should be covered in #2245 or #2246.

Contributor guide

Open the contributing guide

Research direction

Start by reading issues #2245 and #2246, which the request identifies as likely related, and review the full Azure resource ID example in the issue. Done means the requested Bicep behavior is defined for referencing an existing resource from a full ID and for reaching the VMSS portion of that ID.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.