title | description | author | ms.author | ms.service | ms.topic | ms.custom | ms.date |
---|---|---|---|---|---|---|---|
Deploy Azure Cache for Redis using Bicep |
Learn how to use Bicep to deploy an Azure Cache for Redis resource. |
schaffererin |
v-eschaffer |
cache |
conceptual |
subject-armqs, devx-track-azurepowershell |
05/24/2022 |
Learn how to use Bicep to deploy a cache using Azure Cache for Redis. After you deploy the cache, use it with an existing storage account to keep diagnostic data. Learn how to define which resources are deployed and how to define parameters that are specified when the deployment is executed. You can use this Bicep file for your own deployments, or customize it to meet your requirements.
[!INCLUDE About Bicep]
- Azure subscription: If you don't have an Azure subscription, create a free account before you begin.
- A storage account: To create one, see Create an Azure Storage account. The storage account is used for diagnostic data. Create the storage account in a new resource group named exampleRG.
The Bicep file used in this quickstart is from Azure Quickstart Templates.
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.cache/redis-cache/main.bicep":::
The following resources are defined in the Bicep file:
-
Save the Bicep file as main.bicep to your local computer.
-
Deploy the Bicep file using either Azure CLI or Azure PowerShell.
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters existingDiagnosticsStorageAccountName=<storage-name> existingDiagnosticsStorageAccountResourceGroup=<resource-group>
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -existingDiagnosticsStorageAccountName "<storage-name>" -existingDiagnosticsStorageAccountResourceGroup "<resource-group>"
[!NOTE] Replace <storage-name> with the name of the storage account you created at the beginning of this quickstart. Replace <resource-group> with the name of the resource group name in which your storage account is located.
When the deployment finishes, you see a message indicating the deployment succeeded.
Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.
az resource list --resource-group exampleRG
Get-AzResource -ResourceGroupName exampleRG
When no longer needed, delete the resource group, which deletes the resources in the resource group.
az group delete --name exampleRG
Remove-AzResourceGroup -Name exampleRG
In this tutorial, you learned how to use Bicep to deploy a cache using Azure Cache for Redis. To learn more about Azure Cache for Redis and Bicep, see the articles below:
- Learn more about Azure Cache for Redis.
- Learn more about Bicep.