Resource Declarations in Bicep
You'll learn how to declare Azure resources using Bicep's clean, symbolic-name syntax that's far simpler than ARM JSON.
What Is a Resource Declaration in Bicep?
In Bicep, declaring a resource means telling Azure "I want this thing to exist." Unlike ARM templates where you work with verbose JSON arrays, Bicep uses a straightforward resource keyword followed by a symbolic name you choose. This name becomes a handle you can reference throughout your template.
Think of it like naming a character in a story. Once you've introduced "storageAccount" as your storage account, you can refer to it by that name anywhere else in your script—no complex path navigation required.
The Basic Syntax
resource <symbolic-name> '<resource-type>@<api-version>' = {
name: 'actual-resource-name'
location: 'eastus'
properties: {
// resource-specific settings
}
}
The symbolic name (like storageAccount) is what you use in the template. The name property is the actual name Azure will give the resource. The resource type and API version follow the same format as ARM templates, but without the brackets and quotes everywhere.
Accessing Resource Properties
Once declared, you can access properties using dot notation:
resource storage 'Microsoft.Storage/storageAccounts@2021-04-01' = {
name: 'mystorageacct'
location: 'eastus'
}
output storageId string = storage.id
output primaryEndpoint string = storage.properties.primaryEndpoints.blob
No need for reference() or resourceId() functions—just use the symbolic name directly.
Key Takeaway: Bicep resource declarations use symbolic names and clean dot-notation property access, eliminating the complex functions and nested JSON structures required in ARM templates.