Sitemap

šŸ” From a Diagram/Picture to any code, using GitHub Copilot & VS Code

4 min readApr 8, 2025

--

Managing infrastructure in Azure often begins with manually setting up services in the portal. But what if you’ve already built a beautiful setup in a resource group and want to replicate it across environments or subscriptions? That’s where Azure Resource Visualizer, Terraform, and ARM templates come into play.

In this blog, we’ll explore how to:

  • Export its structure as a visual reference
  • Leverage GitHub Copilot and VS Code to streamline the process, to produce a Terraform or an ARM template as Infrastructure-as-Code (IaC)
  • Recreate the same infrastructure in another Azure subscription

šŸ”“ Please note that the ā€œtranslated codeā€ won’t be 100% accurate, and you may need to make minor adjustments, since not all the details of the objects appears in the diagram/picture. However, it will still save you a significant amount of time when writing or translating code.

šŸ“ø Export the Picture Using Azure Resource Visualizer

  • You can use any diagram as an input, not only from Azure Resource Visualizer of course 😁
  1. Go to the Azure Portal: https://portal.azure.com
  2. Navigate to your resource group (rsg)
  3. In the left menu of the resource group, click on Resource Visualizer
  4. It auto-generates a visual map of resources and their dependencies
  5. Click Export (top right corner) → Choose PNG or SVG
Press enter or click to view image in full size

šŸ’” While the visual is helpful, it doesn’t export infrastructure code — for that, continue to Step 2.

🧱Option 1: Translate to ARM Template with GitHub Copilot

Now let’s translate the exported picture into an ARM Template.

  1. Open VS Code
  2. Make sure the following extensions are installed:

3. Open the Copilot chat:

Press enter or click to view image in full size

4. Insert the exported jpg to the chat box and type your request, for example:

Please create an arm template to implement in Azure from the attached picture

Press enter or click to view image in full size

5. The output will contain the full ARM template for a quick implementation in Azure:

Press enter or click to view image in full size

6. Now just copy the code and use it for IAC or deploy it in another subscription.

šŸ“¦Option 2: Translate to a Terraform code with GitHub Copilot

Now let’s translate the exported picture into a Terraform code.

  1. Open VS Code
  2. Make sure the following extensions are installed:

3. Open the Copilot chat:

Press enter or click to view image in full size

4. Insert the exported jpg to the chat box and type your request, for example:

Please create a Terraform script to implement in Azure from the attached picture

Press enter or click to view image in full size

5. The output will contain the Terraform code for a quick implementation in Azure:

Press enter or click to view image in full size

6. Now just copy the code and use it for IAC or deploy it in another subscription.

šŸ’»Option 3: Translate to CLI code with GitHub Copilot

Now let’s translate the exported picture into a CLI code.

  1. Open VS Code
  2. Make sure the following extensions are installed:

3. Open the Copilot chat:

Press enter or click to view image in full size

4. Insert the exported jpg to the chat box and type your request, for example:

Please create a cli script to implement in Azure from the attached picture

Press enter or click to view image in full size

5. The output will contain the full CLI code for a quick implementation in Azure:

Press enter or click to view image in full size

6. Now just copy the code and use it for IAC or deploy it in another subscription.

šŸ›  Bonus: Helpful Tools

🧩 Conclusion: Copilot + Azure = IaC Superpowers

GitHub Copilot is a powerful productivity enhancer when translating Azure infrastructure into reusable code — especially when working with outputs from the Azure Resource Visualizer and Export Template features.

While Azure doesn’t natively convert visuals into Terraform, combining Copilot’s AI code generation with your exported ARM templates bridges that gap. Copilot helps by:

  • Autocompleting Terraform and ARM template syntax
  • Translating resource definitions faster
  • Reducing human error and repetitive typing
  • Speeding up the overall Infrastructure-as-Code workflow

That said, Copilot is most effective as a smart assistant, not a replacement for your understanding. You still need to verify dependencies, naming conventions, and resource relationships — especially in complex Azure environments.

āœ… Best of both worlds: Use Azure’s export capabilities for structure, and let Copilot assist in translating that structure into code you can reuse, version, and scale across subscriptions.

--

--

Tzahi Kolber
Tzahi Kolber

Written by Tzahi Kolber

During the last 18 years, I was working as a Senior PFE within Exchange area at Microsoft. Now I’m Senior Consult as Azure IAAS, DevOps & Automations.