bicep working with existing resources and creating additional resources out of it
We can use bicep with existing resource. Let's say we have a storage account called "mystorage2026jw
To do that can use existing block. Bicep is very particular about placement of the curly braces after the "equal" = sign. Otherwise you will get BCP-007 error
storage-account.bicep
Running az bicep to validate our code is good
az bicep build --file storage-account.bicep
To see your what-if plan
az deployment group what-if -g mytest-kv-rg --template-file storage-account.bicep --query "properties.outputs"
And to run the actual deployment, you do
az deployment group create -g mytest-kv-rg --template-file storage-account.bicep --query "properties.outputs"
Let's switch gear and we would like to create a blob container from an existing storage. If that's the case, what does the code looks like?
As you can see storageAccount is an existing resource. Then we simple create other resources using bicep declarative language
Comments