How to get a FULL arm template ready for deployemnt including all dependent resources like network/storage

John Fak 60 Reputation points
2024-01-10T18:51:51.4566667+00:00

We have deployed Enterprise Redis in our subscription.
We want to have a FULL ARM template (not just the redis cache component) that can automatically redeploy if we tear down or destroy the resource.

How to achieve this ? The docs just talk about very basic arm templates.

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
210 questions
0 comments No comments
{count} votes

Accepted answer
  1. Luis Arias 4,711 Reputation points
    2024-01-10T19:58:46.7866667+00:00

    Hello John Fak,

    The easy way to have your arm template incuding all resources that you want to deploy is going to export option on Resource group with all resources: User's image

    About creating a full Azure Resource Manager (ARM) template that includes all dependent resources like network and storage, and can automatically redeploy if resources are torn down or destroyed, involves several steps. Here’s a general guide:

    1. Define Resources: In your ARM template, you need to define all the resources that your application requires. This includes not just the Redis Cache, but also any dependent resources like virtual networks, storage accounts, etc.
    2. Set Deployment Order: Some resources may depend on others. For example, a virtual machine might depend on a virtual network and a storage account. You can use the dependsOn element in your ARM template to specify these dependencies. Azure Resource Manager will ensure that resources are deployed in the correct order.
    3. Use Existing Templates: Azure provides Quickstart Templates for common configurations, which you can customize to suit your needs. For example, you can start with a template for a simple Windows VM and modify it to include your Redis Cache and other resources.
    4. Redeploy: If resources are torn down or destroyed, you can redeploy them using the same ARM template. This can be done through the Azure portal, Azure CLI, or PowerShell

    This is an extensive topic , because is basically Infrastructure as code there are many options including ARM, I recommend you if you want to delve deeper in this matter learn Bicep and terraform besides ARM for your deployments.

    https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/considerations/infrastructure-as-code

    Cheers, Luis


    If the information helped address your question, please Accept the answer.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Oury Ba-MSFT 16,076 Reputation points Microsoft Employee
    2024-01-18T02:17:16.3033333+00:00

    John Fak Thank you for reaching out.

    In addition to Luis Arias's answer, to deploy the PEP first as pre-requisuite before deploying the redis cache, add the following JSON to your template.

    JSON
    
    Copy
    {
      "type": "Microsoft.Cache/redisEnterprise/privateEndpointConnections",
      "apiVersion": "2023-11-01",
      "name": "string",
      "properties": {
        "privateEndpoint": {},
        "privateLinkServiceConnectionState": {
          "actionsRequired": "string",
          "description": "string",
          "status": "string"
        }
      }
    }
    

    The below doc should help.

    https://learn.microsoft.com/en-us/azure/templates/microsoft.cache/redis?pivots=deployment-language-arm-template

    https://learn.microsoft.com/en-us/azure/templates/microsoft.cache/redis/privateendpointconnections?pivots=deployment-language-arm-template

    Regards,

    Oury

    1 person found this answer helpful.

  2. Oury Ba-MSFT 16,076 Reputation points Microsoft Employee
    2024-01-18T17:24:59.46+00:00

    John Fak  If you export ARM template for a Redis Enterprise resource that is already created, then I noticed that the private endpoint property is empty, which is exactly what you were seeing. However, if you export the template from the creation request i.e. when the Redis Enterprise resource is being created, then the template is populated correctly with all vnet and subnet information - see screenshot below. One thing to note is when I created cache on the portal, I had already created the virtual network, so it is not included in this template. You should be able to easily get a virtual network ARM template by exporting from portal and add it to your deployment template. User's image Hope this helps. Regards, Oury

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.