Automate Deployment Of Resources Using Templates Flashcards
What does arm stand for?
Azure Resource Manager
What is the purpose of Azure Resource Manager?
Whether via the portal , powershell, azure cli , test clients or any other mechanism to manage azure resources, the action passes through an ARM process before interacting with the individual service backends to perform the action.
What notation do ARM templates use?
JSON
What are the main files that form part of a template?
A template file, a parameters file and an optional script file.
What are the 6 root properties of an arm template?
- $chema: usually fixed. Wood change if you use a different type of deployment template in the future but as of 2024 it’s still using the 2015 one
- ContentVersion: user managed versioning string to track which version of the the arm template it is
- parameters: variables which can be passed into the template at execution time
- variables: standard variables which aren’t specified at run time. Think hard coded values or expressions.
- resources: this is an array or resource you want to create. Vnets, VMs, disks, scales etc.
- outputs: these values will be printed to the output log at the end of the deployment process
When modifying an arm template for a vm, what are the additional changes necessary to make if you remove the public ip block?
Any section which dependsOn that public ip being created should have that dependsOn entry removed. The consequence of having a dependency listed which is not actually created as part of the arm template is that the resource will wait forever for that dependsOn to be complete so it wont actually be created.
The ipConfigurations sections in the network interface section is used to map a publicIpAddress to the network interface so if you remove the public ip from the arm template you should also be careful to remove any instructions which do something with it such as attaching it to a network interface.
Generally, removing as single resource seems simple but there can be gotcha’s if it is referenced in other places in the arm template, so be careful!
What are template specs and how are they used?
It’s a library of templates which you can add your own arm templates to.
To do it, open( deprecated ) templates or (recommended) template specs from the azure portal, create new and follow the wizard. You will need to copy the template to this ui.
The template then becomes a resource in the resource group it was added to and can be shared and RBAC permissions assigned.
From the template sites ui you can press the deploy button where you will need to add the parameters from scratch. You can also create new versions of the template spec.
Are azure resources deployed with an arm template idempotent?
Yes. Any resource with the same name and settings defined in an arm template which is the same as an existing resource would be skipped.
How to deploy a an arm template using powershell?
New-AzResourceGroupDeploymemt -ResourceGroupName “<…>” -TemplateFile “<…>” -TemplateParameterFile “<…>”
How to review the deployments of a resource group?
From the deployments link in the blade of the resource group ui in the portal. This history is not complete only holding the last N deployments. Each deployment is incremental and so may look different even though the same template was used.
Are all changes to a resource ( its settings) visible in the resource’s deployment history?
No. A resource’s deployment history tracks the deployments caused by changes to an arm template . Changes made to a resource manually will not be visible in the deployment history, so it’s better to make the changes directly to the arm template rather than to the resource directly.
Azure’s deployment history primarily tracks the deployment operations performed on a resource or resource group, showing the actions taken through Azure Resource Manager (ARM) templates, Azure CLI, Azure PowerShell, and other Azure services. This includes creation, updates, and deletions of resources. However, not all changes made to a resource’s settings may be visible in the deployment history. Here’s why:
- Granularity: The deployment history is focused on the deployment operations themselves, not on fine-grained configuration changes or settings adjustments made post-deployment unless they are made through a new deployment.
- Direct Modifications: Changes made directly to a resource’s settings through the Azure Portal, CLI, or PowerShell might not be recorded as a deployment unless they trigger a new deployment operation. For instance, adjusting a setting on a virtual machine directly might not appear as a separate deployment.
- Service-Specific Logs: Some Azure services track changes to their settings or resources through their own logging and auditing mechanisms, separate from the Azure Resource Manager deployment history. For example, Azure App Service has its own activity logs, and Azure Storage Accounts have storage analytics for tracking requests.
- Auditing and Logging: Azure provides extensive auditing and logging features through Azure Monitor and Azure Activity Log. While the Activity Log records all write operations (PUT, POST, DELETE) performed on your resources, it is more comprehensive and includes operations that might not result in a deployment record.
To get a complete picture of all changes made to a resource or its settings, it’s advisable to consult the Azure Activity Log, service-specific logs, and the deployment history. This approach will provide a more comprehensive view of the actions performed on a resource.
What is bicep?
It’s a declarative pre-processor language which compiles into ARM notation. You write your code in bicep because it’s easier to use, learn, read and understand, then you compile into machine readable ARM template.
What is an arm custom script extension?
It’s a part of an arm template that configures a specific script into be run on a vm. This can be used for getting your vm to a usable state for example by creating a necessary directory structure, creating users etc.
Where can you find azure QuickStart templates from Microsoft?
GitHub at Azure/azure-quickstart-templates