DEV Community

Cover image for Optimizing Your Azure Virtual Machine: Subnets, Scaling, and Storage
Louis Oodo
Louis Oodo

Posted on

Optimizing Your Azure Virtual Machine: Subnets, Scaling, and Storage

Optimizing Your Azure Virtual Machine: Subnets, Scaling, and Storage

Introduction

Once a Virtual Machine is deployed, the real work of an Azure Administrator begins: optimization. Whether you need to move a resource to a more secure network segment, increase computing power to handle heavier workloads, or expand storage for data-heavy applications, knowing how to modify existing resources is critical. In this guide, we will walk through migrating a VM to a new subnet, vertically scaling its size, attaching additional data disks, and implementing cost-saving automation through scheduled shutdowns.


Move the Virtual Machine Network to the New Subnet

  1. Login to Microsoft Azure at https://portal.azure.com.
  2. From the Azure portal home page, in the search box, enter virtual machines.
  3. Select virtual machines under services.
    virtual machines

  4. Select the guided-project-vm virtual machine.
    guided-project-vm

  5. If the virtual machine is running, select Stop.

    Note: In order to make some configuration changes, such as changing the subnet, the VM will need to be restarted. You can request the change without stopping the VM, but Azure will force a restart before completing the change.

  6. Wait for the Status field to update and show Stopped (deallocated).

  7. Within the Networking subsection of the menu, select Network settings.

  8. Select the Network interface / IP configuration hyperlink for the VM.
    Networking

  9. On the IP Configurations page, update the Subnet to ftpSubnet.

  10. Select Apply.
    Apply
    Note: since we couldn't create a VM in east US we will go ahead and select the default for Korea central. In this analogy, vertical scaling is like taking your apartment and upgrading it from a studio apartment (low computing power) to a penthouse suite (high computing power) with more rooms (CPU) and space (RAM).

The physical task of upgrading your apartment (changing its size and amenities) is a completely separate decision from which floor (subnet) it happens to be located on. You can just as easily upgrade an apartment on the default floor as you can an apartment on the ftpSubnet floor. The final "Applying Changes" step, shown in your screenshot, will just register the VM's location and configuration

  1. Select Home to return to the Azure portal home page.

Good job! You’ve migrated the VM from one subnet to another. Remember, the new subnet had specific network security rules applied to help it function as an FTP server.


Vertically Scale the Virtual Machine

The next task from the Azure admin relates to the computing power of the VM. The admin would like you to vertically scale the machine to increase the computing power.

  1. From the Azure portal home page, in the search box, enter virtual machines.
  2. Select virtual machines under services.
    virtual machines

  3. Select the guided-project-vm virtual machine.
    guided-project-vm

  4. Locate the Availability + scale submenu and select Size.
    Availability + scale

  5. Select a new VM size D2s_v5 for example. (Note: If you don’t see the same size as shown in this exercise, select something similar.)

  6. Select Resize.
    Resize

Note: The VM size may not update in the Azure UI until the VM is restarted.

  1. Select Home to return to the Azure portal home page. Home

Well done. With the VM scaled up to a more robust processor, it can handle the new role it’s being assigned.


Attach Data Disks to a Virtual Machine

Now the Azure admin realizes that if the VM is going to serve as an FTP server, it needs more storage. The Azure admin asked you to attach a new data disk to the VM.

  1. From the Azure portal home page, in the search box, enter virtual machines.
  2. Select virtual machines under services.
    virtual machines

  3. Select the guided-project-vm virtual machine.
    guided-project-vm

  4. Locate the settings submenu and select Disks.
    settings

  5. Select Create and attach a new disk.
    Create and attach a new disk

  6. Leave LUN as default.

  7. Enter ftp-data-disk for the Disk name.

  8. Leave the Storage type as default.

  9. Enter 20 for the Size.
    ftp-data-disk

  10. Select Apply to create the new storage disk and attach the disk to the machine.
    Apply

  11. Select Home to return to the Azure portal home page.
    Home
    Nice! Now the VM has enough storage to handle some uploads.


Configure Automatic Shutdown on a Virtual Machine

The final thing the Azure admin is concerned about is the cost of running the computer 24 hours a day. The first thing they’ll do every morning is start up the FTP server. However, they’d like you to configure it to automatically shutdown every day at 7 PM Coordinated Universal Time (UTC).

  1. From the Azure portal home page, in the search box, enter virtual machines.
  2. Select virtual machines under services.
    virtual machines

  3. Select the guided-project-vm virtual machine.
    guided-project-vm

  4. Under the Operations submenu, select Auto-shutdown.
    Operations

  5. In order to let late uploads finish, set the Scheduled shutdown to 7:15:00 PM.

  6. Select Save.
    Note: I ended up using the default as it won't let me change the scheduled shutdown.
    Save

  7. Select Home to return to the Azure portal home page.
    Home


Conclusion

Managing a cloud environment is an iterative process. By moving the VM to a specific subnet, scaling its performance, adding storage, and automating its shutdown, you have transformed a basic virtual machine into a cost-effective, high-performance FTP server. These administrative tasks ensure that your cloud infrastructure remains both functional and fiscally responsible.

Would you like me to walk you through how to verify the new disk inside the Ubuntu OS so you can actually start using that 20GB of space?

Top comments (0)