Azure Resource Manager Interview Questions

0.1. What is IaC

  • IAC stands for Infrastructure as Code.​
  • The provisioning and management of Infrastructure is done via Code​
  • You can maintain the IAC in Version Control systems like Git in the same way developers maintain the source code.
  • With IaC, DevOps engineers author the code once and deploy to multiple environments with ease
  • ARM Templates
  • Bicep
  • Terraform

0.3. What are the advantages of using ARM Templates? Or any other IaC tools?

  • Author once – Deploy multiple times into various environments​
  • Avoid Human Errors​
  • Ability to integrate with Git​
  • Multiple team members can work in parallel on different modules​
  • Possible to follow Git workflow by raising a Pull Request, get the review feedback and improve the quality​
  • Review the history of all the changes from the beginning.​

0.4. How are ARM templates different from Terraform or any other similar offerings?

Because they are native to the Azure platform, Resource Manager templates let you track your deployments in the portal, use deep integration with other Azure services and provision any Azure resource as soon as it is available.

0.5. What are the development tools that you use for working with ARM templates?

  • Visual Studio Code
  • Resource Manager Tools extension for Visual Studio
Advertisements

0.6. Can you explain the structure of the basic ARM Template?

{
    "$schema": "",
    "contentVersion": "",
    "parameters": {},
    "functions": [],
    "variables": {},
    "resources": [],
    "outputs": {}
}

0.7. What are mandatory in the above ARM Template Structure?

The below ones are mandatory

  • Schema
  • ContentVersion
  • Resources

0.8. What is the difference between Parameters and Variables in ARM Templates?

Variables – Variables are helpful for storing some values within the Template. For example: If you want to concatenate something and use it in multiple places then you should use Variables. Variables must be used within ARM Templates.

Parameters – Parameters are similar to variables. However, the values of Parameters can be passed from outside the ARM Template.

0.9. What are ARM template expressions?

ARM Template expressions helps us in writing dynamic code within the ARM Templates. For example, you would like to use contactenate two different strings.

0.10. What are the various functions that you have used inside the ARM Templates?

  • resourceGroup()
  • uniqueString()
  • equals()
  • Concat()
  • Parameters()
  • Variables
  • reference() – This is useful to get the Runtime State of any Azure Service. It needs Resource ID as input.
Advertisements

0.11. What are Parameter Files?

Parameter files are helpful to store the valuesthat we need to pass in during deployment. For ex: We may need to pass different values for different environments. in that case Parameter files are helpful.

0.12. Is it possible to do Conditional Deployment in ARM Templates? if yes, how?

Yes, it is possible using the Condition attribute in the Resource section.

0.13. How do you specify dependency between resources?

We can use dependsOn attribute. it’s an array which accepts multiple resources

0.14. What are Linked Templates? How do you modularize the ARM Templates using Linked Templates?

Short Answer: Linked Templates are helpful for modularizing the templates instead of writing everything in one TemplateFile. 

Long Answer: When you are working on large projects, modularizing the template files into different folders and template file. It helps different DevOps Engineers to be responsible for different module.

0.15. What is the difference between Nested Templates and Linked Templates?

Linked templates: Allows us to create reusable and modular templates.

Nested templates: Allows us to create deployments to multiple ARM scopes or multiple resource groups from a single template file

Advertisements

0.16. How do you validate ARM Templates?

We can validate using the validate command as shown below

az deployment group validate --resource-Group <RGName> --template-file <template file name>

0.17. What are the different modes of deploying the ARM Templates?

  • Incremental – In incremental mode, Resource Manager leaves unchanged resources that exist in the resource group but aren’t specified in the template. Resources in the template are added to the resource group.
  • Complete – In complete mode, Resource Manager deletes resources that exist in the resource group but aren’t specified in the template.

0.18. What are that various scopes in which you can deploy the ARM Templates?

  • Resource Group
  • Subscription
  • Management Group

0.19. How do you preview the changes before deploying the ARM Templates?

It is possible to preview the changes by using the What-If switch while deploying the ARM Templates

az deployment group create --resource-Group <RGName> --template-file <template file name> --confirm-with-what-if

0.20. What are the different ways of deploying the ARM Templates?

  • Azure CLI
  • Azure PowerShell
  • Azure DevOps Pipelines (using ARM Template Deployment task)
Advertisements

0.21. How do you deploy the ARM Template? What is the command?

az deployment group create --resource-Group <RGName> --template-file <template file name>

0.22. How do you troubleshoot the ARM Deployment Errors?

Syntax Errors: Visual Studio Code will provide all the syntax error with Visual Cue’s

Runtime Errors: If the deployment failed, use the verbose switch to get information about the resources being created. Use the debug switch to get more information for debugging.

Validate the Best Practices: The Azure Resource Manager template (ARM template) test toolkit helps in checking whether the template uses recommended practices. We need to use the following command. Test-AzTemplate -TemplatePath Templatepath

0.23. How do you verify if the deployment is successful?

In order to verify the status by navigating to the Deployments blade in the Resource Group

0.24. Can we run the same ARM Templates multiple times to Azure?

Yes. As a DevOps engineer, we always need to keep in mind that ARM Templates would be executed in any environment multiple times. Each time we execute them, only the changes must be deployed. Incremental Deployment could be achieved using the mode: Incremental. It’s optional to provide the mode as Increment is the default value.

0.25. What are Template Specs?

We can use template specs to share ARM templates with other users in your organization.

Advertisements

0.26. Explain the process of running the ARM Templates in Azure DevOps?

Build Stage – Copy the ARM Templates (along with Parameter Files) to Artifacts Release Stage – Download the ARM Templates from Artifacts Execute the ARM Templates using ARM template deployment task

0.27. How do you retrieve the ARM Template Outputs in the Azure DevOps pipeline?

Once the ARM Templates are executed using ARM Template Deployment task, we may need to use the Outputs of ARM Template in any subsequent steps for further usage. In such scenarios, we need to use ARM Output task.

0.28. What are the limitations of ARM Templates?

  • Limit the size of your template to 4 MB​
  • Each parameter file to 64 KB. ​
  • The 4-MB limit applies to the final state of the template after it has been expanded with iterative resource definitions, and values for variables and parameters.​

0.29. How do you validate if ARM Templates are following Best Practices?

The Azure Resource Manager template (ARM template) test toolkit helps in checking whether the template uses recommended practices. We need to use the following command. Test-AzTemplate -TemplatePath Templatepath

Advertisements

Do you like this article? If you want to get more updates about these kind of articles, you can join my Learning Groups

WhatsApp

Telegram

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s