Kode Kloud Azure

Problem: 1

The Nautilus DevOps team is strategizing the migration of a portion of their infrastructure to the Azure cloud. Recognizing the scale of this undertaking, they have opted to approach the migration in incremental steps rather than as a single massive transition. To achieve this, they have segmented large tasks into smaller, more manageable units. This granular approach enables the team to execute the migration in gradual phases, ensuring smoother implementation and minimizing disruption to ongoing operations. By breaking down the migration into smaller tasks, the Nautilus DevOps team can systematically progress through each stage, allowing for better control, risk mitigation, and optimization of resources throughout the migration process.

For this task, create an SSH key pair on Azure Portal with the following requirements:

  • The name of the SSH key pair should be nautilus-kp.
  • The key pair type must be rsa.

Problem: 2

The Nautilus DevOps team is planning to migrate a portion of their infrastructure to the Azure cloud incrementally. As part of this migration, you are tasked with creating an Azure Virtual Machine (VM).

The requirements are:

  1. Use the existing resource group.
  2. The VM name must be datacenter-vm, it should be in West US region.
  3. Use the Ubuntu 22.04 LTS image for the VM.
  4. The VM size must be Standard_B1s.
  5. Attach a default Network Security Group (NSG) that allows inbound SSH (port 22).
  6. Attach a 30 GB storage disk of type Standard HDD.
  7. The rest of the configurations should remain as default.

After completing these steps, make sure you can SSH into the virtual machine.

Problem: 3

The Nautilus DevOps team is strategizing the migration of a portion of their infrastructure to the Azure cloud. Recognizing the scale of this undertaking, they have opted to approach the migration in incremental steps rather than as a single massive transition. To achieve this, they have segmented large tasks into smaller, more manageable units. This granular approach enables the team to execute the migration in gradual phases, ensuring smoother implementation and minimizing disruption to ongoing operations.

  • Create a Virtual Network (VNet) named devops-vnet in the East US region with any IPv4 CIDR block.

Problem: 4

The Nautilus DevOps team is strategically planning the migration of a portion of their infrastructure to the Azure cloud. Acknowledging the magnitude of this endeavor, they have chosen to tackle the migration incrementally rather than as a single, massive transition. Their approach involves creating Virtual Networks (VNets) as the initial step, as they will be provisioning various services under different VNets.

  • Create a Virtual Network (VNet) named datacenter-vnet in the East US region with 192.168.0.0/24 IPv4 CIDR.

Problem: 5

The Nautilus DevOps team is strategically planning the migration of a portion of their infrastructure to the Azure cloud. Acknowledging the magnitude of this endeavor, they have chosen to tackle the migration incrementally rather than as a single, massive transition. Their approach involves creating Virtual Networks (VNets) as the initial step, as they will be provisioning various services under different VNets.

  • Create a Virtual Network (VNet) named nautilus-vnet in the East US region with both an IPv4 and a manually provided full IPv6 address space. Use 2600:abcd:1234::/48 for the IPv6 CIDR block.

Problem: 6

The Nautilus DevOps team is strategizing the migration of a portion of their infrastructure to the Azure cloud. Recognizing the scale of this undertaking, they have opted to approach the migration in incremental steps rather than as a single massive transition.

  • For this task, create a Virtual Network (VNet) named devops-vnet and one subnet named devops-subnet within the VNet in the East US region. Make sure the IPv4 address range is 10.0.0.0/16.

Problem: 7

The Nautilus DevOps team is strategizing the migration of a portion of their infrastructure to the Azure cloud. Recognizing the scale of this undertaking, they have opted to approach the migration in incremental steps rather than as a single massive transition. To achieve this, they have segmented large tasks into smaller, more manageable units. This granular approach enables the team to execute the migration in gradual phases, ensuring smoother implementation and minimizing disruption to ongoing operations. By breaking down the migration into smaller tasks, the Nautilus DevOps team can systematically progress through each stage, allowing for better control, risk mitigation, and optimization of resources throughout the migration process.

  • For this task, allocate a Public IP address, name it as devops-pip.

Problem: 8

During the migration process, several resources were created under the Azure account. Later on, some of these resources became obsolete as alternative solutions were implemented. Similarly, there is a virtual machine (VM) that needs to be deleted as it is no longer in use.

  1. Delete the virtual machine named xfusion-vm present in the West US region.
  2. Before submitting your task, make sure the VM is in the deleted state.

Problem: 9

During the migration process, several resources were created under the Azure account. Later on, some of these resources became obsolete as alternative solutions were implemented. Similarly, there is a Virtual Machine that needs to be deleted as it is no longer in use.

Recent security restrictions have revoked Azure Portal access. Nevertheless, the team retains CLI access via the azure-client host (the landing host for this lab), allowing them to manage Azure resources effectively.

  1. Using Azure CLI, delete a virtual machine named datacenter-vm present in the eastus region.
  2. Before submitting your task, make sure the VM is in deallocated or deleted state.

Solution: 

1. Locate the Virtual Machine
Find the resource group and confirm the VM exists:

# az vm list --query "[?name=='datacenter-vm']" -o table

Output 

~ ➜  az vm list --query "[?name=='datacenter-vm']" -o table
Name           Location    ProvisioningState    VmId                                  TimeCreated                       ResourceGroup
-------------  ----------  -------------------  ------------------------------------  --------------------------------  ----------------------------
datacenter-vm  westus      Succeeded            235afd2c-ef47-4a56-8b72-0b7c898bfcbf  2025-01-18T03:38:49.436147+00:00  KML_RG_MAIN-4A452AA706E54D8F
~ ➜  

This command will display the VM and its resource group.

2. Deallocate the Virtual Machine (Optional)
If the VM is running, deallocate it first:

# az vm deallocate --name datacenter-vm --resource-group <resource-group-name>

Replace <resource-group-name> with the actual resource group name.

Output 

~ ➜  az vm deallocate --name datacenter-vm --resource-group KML_RG_MAIN-4A452AA706E54D8F

3. Delete the Virtual Machine
Delete the VM and associated resources:

# az vm delete --name datacenter-vm --resource-group <resource-group-name> --yes

The --yes flag confirms the deletion without prompting.

Output 

~ ➜  az vm delete --name datacenter-vm --resource-group KML_RG_MAIN-4A452AA706E54D8F --yes

5. Verify Deletion
Ensure the VM is deleted:

# az vm list --query "[?name=='datacenter-vm']" -o table

If no output is returned, the VM has been successfully deleted.

Output 

~ ➜  az vm list --query "[?name=='datacenter-vm']" -o table

Note: Deleting a VM does not automatically delete associated resources like disks or network interfaces. Use the following commands if needed:

 6. List resources associated with the VM:

# az resource list --resource-group <resource-group-name> --query "[?contains(name,'datacenter-vm')]" -o table

Output 

~ ➜  az resource list --resource-group KML_RG_MAIN-4A452AA706E54D8F --query "[?contains(name, 'datacenter-vm')]" -o table
Name                                                     Location    CreatedTime                       ChangedTime                       ProvisioningState    ResourceGroup                 ManagedBy
-------------------------------------------------------  ----------  --------------------------------  --------------------------------  -------------------  ----------------------------  ---------------------------------------------------------------------------------------------------------------------------------------------------------
datacenter-vmNSG                                         westus      2025-01-18T03:38:42.266721+00:00  2025-01-18T03:48:44.435086+00:00  Succeeded            kml_rg_main-4a452aa706e54d8f
datacenter-vmPublicIP                                    westus      2025-01-18T03:38:42.271854+00:00  2025-01-18T03:48:46.428710+00:00  Succeeded            kml_rg_main-4a452aa706e54d8f
datacenter-vmVNET                                        westus      2025-01-18T03:38:42.285943+00:00  2025-01-18T03:48:49.872777+00:00  Succeeded            kml_rg_main-4a452aa706e54d8f
datacenter-vmVMNic                                       westus      2025-01-18T03:38:47.533898+00:00  2025-01-18T03:48:48.539533+00:00  Succeeded            kml_rg_main-4a452aa706e54d8f
datacenter-vm_OsDisk_1_ca776d2fd2d94dbd92246f0c9303603d  westus      2025-01-18T03:38:51.240685+00:00  2025-01-18T03:48:51.274702+00:00  Succeeded            KML_RG_MAIN-4A452AA706E54D8F  /subscriptions/a2b28c85-1948-4263-90ca-bade2bac4df4/resourceGroups/kml_rg_main-4a452aa706e54d8f/providers/Microsoft.Compute/virtualMachines/datacenter-vm
~ ➜  

7. Delete associated disks:

# az disk delete --name <disk-name> --resource-group <resource-group-name> --yes

Output 

~ ➜  az disk delete --name datacenter-vm_OsDisk_1_ca776d2fd2d94dbd92246f0c9303603d  --resource-group KML_RG_MAIN-4A452AA706E54D8F --yes

8. Delete network interfaces:

# az network nic delete --name <nic-name> --resource-group <resource-group-name>

Ensure the VM and its resources are fully deleted before submitting the task.

Output 

~ ➜  az network nic delete --name datacenter-vmVMNic --resource-group KML_RG_MAIN-4A452AA706E54D8F

9. Verify Resources

Output 

~ ➜  az resource list --resource-group KML_RG_MAIN-4A452AA706E54D8F --query "[?contains(name, 'datacenter-vm')]" -o table
Name                   Location    CreatedTime                       ChangedTime                       ProvisioningState    ResourceGroup
---------------------  ----------  --------------------------------  --------------------------------  -------------------  ----------------------------
datacenter-vmNSG       westus      2025-01-18T03:38:42.266721+00:00  2025-01-18T03:48:44.435086+00:00  Succeeded            kml_rg_main-4a452aa706e54d8f
datacenter-vmPublicIP  westus      2025-01-18T03:38:42.271854+00:00  2025-01-18T03:48:46.428710+00:00  Succeeded            kml_rg_main-4a452aa706e54d8f
datacenter-vmVNET      westus      2025-01-18T03:38:42.285943+00:00  2025-01-18T03:48:49.872777+00:00  Succeeded            kml_rg_main-4a452aa706e54d8f
~ ➜ 

No comments:

Post a Comment