Share via

Managing scripts to programmatically create Azure resources

Wonderful World 116 Reputation points
2023-07-11T19:18:56.6533333+00:00

I use a couple of resources like AD B2C, storages like table and blob, Azure functions, SQL, Cognitive Services for my project. These resources are created manually in the portal. I want to create them through script in an automated fashion so I can delete them and re-deploy whenever I or other developers want to create them.

My questions are:

  1. What is the right latest library that I can use to create Azure resources programmatically? I read the ARM template is outdated now.
  2. I want to create these resources from GitHub through Git Actions. Is that possible?
  3. Is it possible to generate resource creation scripts from Azure Portal for all the resources which I can use as a starting point?
  4. From where should I run the scripts to generate the resources? Is it possible to run from the Azure Portal?
Azure SQL Database
Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

0 comments No comments

Answer accepted by question author

Luke Murray 11,601 Reputation points MVP
2023-07-11T19:53:13.7733333+00:00

Hi, Wonderful. There are various ways of doing this:

It depends on your use case; if you want to provision resources outside of Azure (ie AWS, Active Directory, etc), then Terraform may be worth starting with (look at the providers).

Terraform has a comprehensive document on the AzureRM provider.

Else if you want to go Azure native, then Azure Bicep is a great choice, and Microsoft already has a repo of a lot of existing resources that you can pull from here: https://github.com/Azure/ResourceModules.

Its worth noting, that the skills you mean in Bicep and Terraform as example, can help you work with both, even though they are different languages a lot of the syntax is very similar - so in my opinion, you can't go wrong with either.

There are various Youtube videos, out there for free across all these different areas to learn from, including looking at the examples.

In terms of importing existing resources, you can use Import Resource with Bicep, and aztfexport with Terraform.

Both can be deployed via Github actions (Terraform)(Bicep), and of course any PowerShell command you can run can also be deployed with github.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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