In this tutorial we are going to cover the few essential building blocks of your Azure journey. This will help you get started in Administration in Azure by creating few resources in Azure.
We will cover from basic concepts to some in-depth ideas. Each step represents the essential tasks that one has to perform. We will be using various Azure resources and administer them. This is a hands-on tutorial. You can read through it to get an introductory understanding of how Azure Admins works or do hands-on in parallel to refresh or learn skills. The Azure Portal link is portal.azure.com .
Step 1 - Resource Groups + Tags + Cloud Shell
Let’s Create a Resource Group.
- In The Search Blade or Home look for a Resource Group.
- Open it and fill details as shown below.
- Click Next : Tags.
- Add Tags, Environment named Dev and Department named Engineering.
- After you get validation passed.
- Click Create.
Takeaways
Resource Groups are essential for organizing all the Azure resources. This helps us to track resources that belong to the same category of the lifecycle. For example, we can put all the development related resources under the dev resource group and testing under the test resource group and production resources under the prod resource group.
One more logical way of organization of resources is using tags. You can create any tag for serving the purpose as per your need. In this case, we can use the Department to separate resources from Sales or other departments. This will help us in meeting our resource organization based hierarchy.
Now, let’s create one resource group for the production environment. This time we will use Azure CLI. This is freely available
here or we can use Cloud Shell. Cloud Shell is very handy and is available all the time in the portal irrespective of the OS or Machine you use. For this purpose you need to set up one storage account that is automatically provisioned on one click when you open the Cloud Shell.
- On the Top Bar Look For Console Symbol.
- Click on it
- If you are using it for the first time, Click create storage account.
- Wait for Cloud Shell to get Provisioned.
Type the command below,
az group create \
--location westus \
--name rg-wus-prod \
--tags Department=Engineering Environment=Prod
Step 2 - Resource Locks
Now production resources are very critical for businesses. To protect production resources from any kind of changes, we will add Resource Locks. There are two types of locks -- read-only and delete.
Read-only
One cannot alter anything in that resource and cannot delete it.
Delete
One can alter anything in a resource but cannot delete it.
Now, keeping the business requirement as critical we will add Read-only lock.
- Open Resource Group from by Searching from Search Bar.
- Under Settings section Click Locks
- Click Add Button
- Write Lock name, Lock Type and Notes.
- Click Ok.
Now, to modify anything in production we will need to change it to delete type make changes and then make it read-only again.
Takeaways
Resource locks are essential for businesses. They add one more step that helps to Safeguard the resources from accidental deletion. I would recommend you to always use it wherever possible.
Step 3 - Azure CosmosDB and Azure Functions + Tags
Now, we will create two actual resources that a dev will work on, Azure CosmosDB and Azure Functions.
A brief overview about both,
- Azure CosmosDB
A Multi-model NoSQL Database with very low latency and can scale at any level. We can write queries in multiple ways and support stored procedure also. Link: https://docs.microsoft.com/en-us/azure/cosmos-db/introduction
- Azure Functions
A capability to create serverless applications. Can connect with almost any Azure Service, as it has a large number of connectors supported. Link: https://azure.microsoft.com/en-in/services/functions/
Firstly, we will create a resource in the Dev Resource Group and then we will deploy the same to production seamlessly.
Let’s create Azure CosmosDB in the Dev Resource Group.
- Search for Azure CosmosDB.
- Click Create.
- Fill the details and review all details.
- go to tags and add 2 tags : Environment=Dev and Department=Engineering.
- Click on Create.
Now, similarly we will create an Azure Function.
- Fill all the details in each steps and review from below.
- Click create.
Step 4 - Azure Resource Manager (ARM) Templates
Now, we will download the ARM Template for deployment to production.
- Open Resource Group
- Under Automation Section select Export Template.
- Click Download on Top Left.
- Change all the Values that are “Dev” to “Production” and Verify Changes as required.
This is how ARM Template structure looks,
- {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "",
- "apiProfile": "",
- "parameters": { },
- "variables": { },
- "functions": [ ],
- "resources": [ ],
- "outputs": { }
- }
You can refer to Docs for more details about Azure Templates, https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/overview
Now, let’s upload this ARM Template.
Step 5 - Azure CLI
For this, we will download Azure CLI in our machine. For downloading Azure CLI in windows/macOS/linux we will use
here.
As per your need, download the template. After downloading type the below command to verify.
> az --help
Now, let’s connect our Azure Portal from CLI and deploy this Template. Type the commands below,
az login
- This will open another window in the browser and ask for login details. Once filled you will get acknowledgement and you can close that window.
- Open the path that contains the template.json file.
- Now, before deployment change resource lock to Delete (currently it is Read-Only), This step is applicable if you are following since the beginning. Once updated run the command below.
az deployment group create --name prodDeploy --resource-group rg-wus-prod --template-file "template.json"
- Verify your deployment in the resource group.
- Now change lock to Read-Only.
- Congratulations on taking your Azure admin journey from development To production.
Takeaways
Azure CLI is a Cross-platform way of communicating with Azure. One-time tasks can be handled with Azure Portal. Azure CLI helps save a lot of time that requires deploying a lot of resources.
ARM Templates play a very important roles in Automation. Using ARM + CLI you can automate repetitive tasks. There is a better solution, Azure Blueprints, that will provide an efficient way of automation in coming days: https://docs.microsoft.com/en-us/azure/governance/blueprints/overview
Step 6 - Azure Mobile App
You can do many amazing things with the Azure Mobile App. You can have a cloud shell at your fingertips. You can monitor resources and do much more. This is the amazing power of a Cloud mobile app.
Summary
Proper resource organization in Azure can help you effectively administer all the resources. You must use as many capabilities of Azure as possible. There are many more solutions available depending upon your needs.
So far, we have been introduced to,
- Resource Groups,
- Tags,
- Resource Locks,
- CosmosDB
- Azure Functions
- Azure CLI / Cloud Shell
- ARM Templates
- Azure Mobile App
That’s it!! Always stay updated about Azure! Keep reading, and thank you for reading until the end.