Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This quickstart shows you how to use a Bicep file to deploy a Storage Discovery workspace in Azure.
Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.
Prerequisites
- If you don't have an Azure subscription, create a free account before you begin.
Review the Bicep file
The Bicep file used in this quickstart is from Azure Quickstart Templates.
@description('Storage Discovery Workspace name')
param workspaceName string
@description('Storage Discovery Workspace location')
param workspaceLocation string = resourceGroup().location
@description('Storage Discovery Workspace SKU')
param workspaceSku string
@description('Storage Discovery Workspace description')
param workspaceDescription string = ''
@description('Storage Discovery Workspace roots')
param workspaceRoots array = []
@description('Storage Discovery Workspace scopes')
param workspaceScopes array = []
@description('Storage Discovery Workspace tags')
param tags object
resource storageDiscoveryResource 'Microsoft.StorageDiscovery/storageDiscoveryWorkspaces@2025-09-01' = {
name: workspaceName
location: workspaceLocation
properties: {
sku: workspaceSku
workspaceRoots: workspaceRoots
description: workspaceDescription
scopes: workspaceScopes
}
tags: (empty(tags) ? {} : tags)
}
Parameters
The template lists Discovery workspace properties that require extra objects:
| Name | Description |
|---|---|
workspaceRoots |
The workspace root designates the storage resources to get insights for. This string[] can contain a combination of subscription IDs and resource group IDs. You may mix and match these resource types. The identity under which you deploy this template must have permissions to all resources you list at the time of deployment. |
scopes |
You can create several scopes in a workspace. A scope allows you to filter the storage resources the workspace covers and obtain different reports for each of these scopes. Filtering is based on ARM resource tags on your storage resources. This property expects a JSON object containing sections for tag key name : value combinations or tag key names only. When your storage resources have matching ARM resource tags, they're included in this scope. |
Here's an example of the JSON structure defining a single scope in a Discovery workspace.
Storage resources are included in this scope when they have both ARM resource tags:
- The tag key
Departmentordepartmentwith case-matching valueMarketing. - The tag key
Apporapp, regardless of its value.
"scopes": [
{
"displayName": "Marketing App Resources",
"resourceTypes": [
"Microsoft.Storage/storageAccounts"
],
"tags": {
"Department": "Marketing"
},
"tagsKeyOnly": [
"App"
]
}
Note
In Azure, tag names (keys) are case-insensitive for operations. Tag values are case-sensitive.
Deploy the Bicep file
Save the Bicep file as
main.bicepto your local computer.Deploy the Bicep file by using either Azure PowerShell or Azure CLI.
New-AzResourceGroup -Name exampleRG -Location eastus
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -adminUsername "<admin-username>"
Note
Replace <admin-username> with a username you can authenticate with.
Review deployed resources
Use the Azure portal, Azure PowerShell, or Azure CLI to list the deployed resources in the resource group.
Get-AzResource -ResourceGroupName exampleRG