Referencing existing resources
There are two scenarios where you would want to reference an existing resource. The first is when a resource has been defined in the same template, while the second is when a resource has already been deployed to Azure. First, let's cover the scenario of referencing a resource that is included in the same template.
Referencing a resource that is in the same file
Remember that you need a symbolic name for every resource that is included in your Bicep file. You can use this same symbol so that you can use that resource later in your template. This might be required for a wide variety of reasons, such as accessing keys or connection strings, adding child resources, and accessing properties such as the domain name or IP address of a resource.
Using a resource later in your template is as simple as using the symbolic name you assigned to your resource. In terms of our storage account, it would be used to, for example, get the list of its keys...