How to update and redeploy ARM template - azure

I am new to Azure as well as Devops, ARM template etc..I have deployed an ARM template for key valut with a name "ABC" via DevOPs. Now I would like to change some parameters. I don't have access to do it via portal and I am forced to use only ARM template. How can this be achieved via devops? Should I delete that resource and start from the scratch or any SOP to update resource parameters via ARM templates. For example I want to enable "“enabledForDeployment” for already deployed kay-vault. Thanks.

generally speaking you just re-run the same template with the changes you've introduced to the template. there are many ways of deploying the template (az cli, powershell, built-in steps, various sdk's).
just keep in mind, some properties are settable only at creation time, so effectively read only, you wouldn't be able to update those after the resource is created, some resource providers do not play well with idempotent behavior and this will also lead to issues when you try to redeploy the same template, some providers offer dodgy behavior when you need to use a completely different api call to update something compared to creating it.
So there's no single answer, but for what you are doing, just updating the template and running it again should work just fine.

You can do it through PowerShell,
Update a resource in an Azure Resource Manager template

Related

Azure API manager using terraform

I am new to Terraform and was wondering if we can use Terraform to implement a kind of disaster recovery for Azure API manager.
I know there is disaster recovery implementation by Microsoft for API manager but I wanted to explore if I can just recreate the whole thing using Terraform.
I am able to recreate the API manager using Terraform with the same configuration/APIs etc.
The only thing which is unclear to me how to back up and recreate the same subscriptions/products in API manager using Terraform.
For example, if someone deletes the API manager, I want to recreate it using Terraform and import all the existing products/subscriptions (keys).
Any ideas?
Similar to using ARM Templates, you can use Terraform to deploy Azure APIM as well. You refer the azurerm provider docs for more information.
But for all runtime data like users & subscriptions, you will have to consider setting up a backup/restore system utilizing the built-in feature.
After deploying APIM using terraform, you will have to restore the runtime data separately. Also, depending on your Recovery Time Objective, you will have to take frequent backups.
PS: Logic Apps are a great way to setup automatic backups. There is an official sample that you can refer to for this.

Rollback deployment on Azure

I was doing an arm template deployment of Azure data factory from dev-ops pipelines. Mistakenly I have chosen deployment mode as complete because of that all the resources inside my target resource group are deleted(DW, ADF, Databricks and all other resources).
Is there any way to rollback?
unless everything was deployed by a single template - no. your only option is to redeploy individual templates. but that wont bring back any data you had.
if everything was deployed with a single template there is a -previous switch in powershell, but assuming all the extra things got deleted, this doesnt apply to your case.

APIM ARM template creation

I have an APIM instance and API's working on it. I want to create ARM template for deployment but can't understand how to do it. I only have the Azure portal repository for it and don't want to create a VSO repository. I am new to ARM templates, so don't have much information.
You can put all your code like the arm templates or swagger files wherever you want, GitHub, Azure DevOps, locally only ... and then deploy your api using Api-M's REST interface (https://learn.microsoft.com/en-us/rest/api/apimanagement/api/createorupdate), the PowerShell AzureRm or Az module https://learn.microsoft.com/en-us/powershell/module/azurerm.apimanagement/import-azurermapimanagementapi?view=azurermps-6.13.0 or by deploying an arm template.
When it comes to creating arm templates you may take a look here:
https://github.com/Azure/azure-quickstart-templates/blob/master/101-azure-api-management-create/azuredeploy.json
Anyway, we first started with arm templates as well and found later out that it's easier to use the REST interface or the PowerShell module by deploying a swagger file and the policies.

Copy Azure Resources to client azure account

We are working on following within Azure portal
Azure Functions
Data Factory
Logic Apps
Storage account (not files)
Now as we are done with development, we need to deploy these azure resources in client's UAT environment
I looked around (might be missing something) and found that deployment of Azure resources is not straightforward.
In Azure, it is like another subscription, correct?
So found this blog, which works with different PowerShell scripts to copies from one subscription to another
This is the right approach? & it cover everything required for resources to execute flawless (I still need to go thru scripts) for e.g. permissions, Data Factory datasets, etc?
Any other way to deploy (kind of export & import)?
Basically what you need is to create a reusable arm template, your question lacks some details yet ARM templates are the way of automated deployment in Azure, on a high-level
start by authoring your arm template to deploy the vanilla required resources look here
https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites/functions
https://learn.microsoft.com/en-us/azure/templates/microsoft.datafactory/factories
https://learn.microsoft.com/en-us/azure/templates/microsoft.logic/integrationaccounts
https://learn.microsoft.com/en-us/azure/templates/microsoft.datalakeanalytics/accounts/storageaccounts
you can combine all of them in one big template using ARM template dependency and other functions
look here
https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions
after you finish ARM templates can be used in many ways including PowerShell, direct API calls or even you can create a deployment in Azure and save it to be reused with a click
look here, also if there will be a high volume of users consider adding it to market place.
https://learn.microsoft.com/en-us/azure/azure-resource-manager/
after finishing your implementation of vanilla resources you can then move into adding any customization you might have.
this is the right and best way to do "afaik"
also look here to see all of your existing resources in an arm template view
https://resources.azure.com/
my understanding of Azure is that almost everything with some few exceptions has an ARM template representation
hope this would help.

How to rebuild a complex azure environment

I have a complex azure environment where there are so many components and dependencies.
Should I divide it to multiple deployments ? Even one resource has lots of dependencies.
Such as with the keys involving service fabric
According to your description, as 4c74356b41 says, I suggest you could use arm template to achieve your requirement.
Resource Manager template - A JavaScript Object Notation (JSON) file that defines one or more resources to deploy to a resource group. It also defines the dependencies between the deployed resources. The template can be used to deploy the resources consistently and repeatedly.
By using arm template. you could use linked templates to link different resources to achieve one resource has lots of dependencies.
More details about what is arm template and getting started, you could refer to this article.
Besides, there are also multiple arm template example, you could refer to this url to know how to create the template.
Besides, if you have created a resource group and it contains multiple resources, you could directly download its deploy template for next deployment by using automation script feature.
Notice: Not all the resource will be automatic included in the auto template.
More details, you could refer to this image:

Resources