Rollback deployment on Azure - 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.

Related

Complete mode deployment in Azure DevOps for ADF

I tried to deploy ARM template for azure Data Factory as part of DevOps implementation.
Mode of deployment was selected as complete in oreder to cleanup the existing adf instance and deploy only the pipelines that are available in ARM template. as shown below.
When I tried to run the deployment, It failed with an error as
##[error]The deployment failed because some resources could not be deleted. This might be due to not having permissions to delete resources in the targeted scope. Please see https://aka.ms/arm-debug for usage details.
2020-11-02T05:33:34.5795133Z ##[error]Check out the troubleshooting guide to see if your issue is addressed: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
When I did a debug on this issue, i could understand that the deployment scope is selected as Resource Group and deployment task tried to delete all the resources under this resource group and failed because it couldnt delete resources other than ADF instance because of access issues.
Since I do not have access to other resources, they were not deleted, otherwise i could have messed up everything by deleting all other resources like ADLS, databricks, sql....
Since I am deploying ADF ARM template is there any way to restrict the deployment scope only for ADF instance, which will not affect other resources.
Any leads appreciated!
I have a query about the What-If feature provided by azure for ARM template deployment. Can we use this in our Release pipeline as a powershell task?
You cannot restrict the deployment scope lower than the ResourceGroup as you noticed.
The only way for you to do this would be either putting the ADF in a seperate resource group but i asume that is not possible.
A second way of doing this would be deleting the ADF through the portal or powershell and then do an incremental deployment of you ARM template that has only the ADF definition in it.
Microsoft rolled out a new feature for ARM deployments called What-If. This is a super nice feature to check what changes to what resources will happen when deploying your template. Note, it only works with powershell core at the moment. If you work with ARM templates this could help you and catch resource deletion before you deploy anything.
When deploying a data factory, do not select Complete as your deployment mode. This will overwrite all resources in the resource group including non-ADF entities.
Selecting Incremental will deploy only the resources located in the ARM template. If generated from the adf_publish branch, then this will contain all of the resources in your factory.

Delete resource in ADF through ARM templates in CI/CD not working

In my ADF CI/CD setup mentioned here, when I deploy to ACC or PRD after I have deleted some resources (linked service or pipeline), it is not getting deleted in ACC or PRD. But those things I add or edit are updated correctly. How can I fix it ?
I'm assuming the deployment task is set to Incremental as in your documentation. If this is the case then the deployment is doing a delta on the existing defined resources. Since the ones deleted out of your ARM template the Deployment task does not know to evaluate them. You can set it to "deployment" mode as stated in the link you provided:
Keep in mind this will delete and recreate and potentially involve some downtime while recreation occurs.
For more information check out the different Azure Resource Manager deployment modes.

Azure - Automatically add new Appservice to Frontdoor

We are deploying a lot of Appservices in Azure trough Azure Devops in different pipelines. For each Appservice we deploy a West and a North Europe instance. We would like to add them automatically to Azure Fontdoor (with ARM template) with a frontend domain. We have ARM templates in place (the default one from Microsoft) but the template is not incremental. So when we add one the allready configured ones dissapear.
Any idea how we can add Appservices one by one to Frontdoor without having the full list off appservices available?
You could try to use the ARM template deployment task. This task supports incremental deployment of app service.
I use the azuredeploy.parameters.json file to input the parameters.
Here is the example:
Then I use this file in the ARM template deployment task and select the incremental option.
For the first time, you can directly use the parameters in the file.
For the next time, you could add custom parameters to the Override template parameters field.
Result:
App service will not be overwritten.
Hope this helps.

How to update and redeploy ARM template

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

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.

Resources