I have 2 azure bicep files.
- Storage.bicep
- cdn.bicep
Now, I successfully created a storage account and BLOB container from storage.bicep. Is it possible to get the value of storage account properties from storage.bicep to use it in cdn.bicep ?
I have 2 azure bicep files.
Now, I successfully created a storage account and BLOB container from storage.bicep. Is it possible to get the value of storage account properties from storage.bicep to use it in cdn.bicep ?
Yes, you can reference Storage Account in cdn.bicep
as existing resource if you pass Storage Account name in to it.
resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' existing = {
name: 'examplestorage'
}
output blobEndpoint string = stg.properties.primaryEndpoints.blob
Just make sure you declare cdn.bicep
has dependency on Storage.bicep
and is executed after it.
The example above is taken from documentation.