Moving resource to another subscription or another resource group

In this post i will discuss how to move your Azure resource to another account, subscruiption or even another resource group.

when we are talking about resource we mean by that, disk, vm, IP, interface .. etc let’s say everything you create it, it’s consider as resource.

Sometimes you asked to moved your resource to another subscruiption but in my case i need to orgazine the infrastrcutre and make it much more easier to manage by create different resource group, do this it’s very simple step, you can do it either using Azure CLI, Powershell or GUI.

To do this just follow the screenshot :-

  • Login to Azure portal here.
  • From the Dashboard as you see below choose from the left panel –> Resource group

As you see from the below

  • new windows will be opened which the resource group that you have, just choose which one you want by pressing on it, choose from the list , export template
  • Once you choose this option, Azure will start Generating the template, but it will take some time depends on your resource group and how much resource it has, once it’s finished press Download.
  • Congrats, now you are having your resource as JSON file.

Thanks

Osama

Monitoring Azure services

Azure provides two primary services to monitor the health of your apps and resources.

  • Azure Monitor
  • Azure Service Health

Azure Monitor

maximizes the availability and performance of your applications by delivering a comprehensive solution for collecting, analyzing, and acting on telemetry from your cloud and on-premises environments. It helps you understand how your applications are performing and proactively identifies issues affecting them and the resources they depend on.

also it can collect data from different source such as application, operating system, and platform .. etc. for example the following will explain what i mean :-

What it’s monitorDescription
Application monitoring datacollect data about performance and functionality of the code you have written, regardless of its platform.
 OS monitoring dataData about the operating system on which your application is running.
resource monitoring dataData about the operation of an Azure resource.

subscription monitoring dataData about the operation and management of an Azure subscription
tenant monitoring dataData about the operation of tenant-level Azure services such azure AD.
Table explain what is the monitor in Azure Monitor

Azure Monitor starts collecting data. Activity Logs record when resources are created or modified and Metrics tell you how the resource is performing and the resources that it’s consuming, You can extend the data you’re collecting into the actual operation of the resources by enabling diagnostics and adding an agent to compute resources, also with Azure Monitor you can extend the monitoring to be for example :-

  • Application Insights is a service that monitors the availability, performance, and usage of your web applications, whether they’re hosted in the cloud or on-premises.
  • Azure Monitor for containers is a service that is designed to monitor the performance of container workload
  • Azure Monitor for VMs is a service that monitors your Azure VMs at scale, by analyzing the performance and health of your Windows and Linux VMs

How it’s works ?

Alert :- from the name it will notify the admin to about the erros or thereshould to take corrective actions,Alert rules based on metrics can provide alerts in almost real-time, based on numeric values. Alert rules based on logs allow for complex logic across data, from multiple sources.

AutoScale :- uses Autoscale to ensure that you have the right amount of resources running to manage the load on your application effectively.

Azure Service Health

provide personalized guidance and support when issues with Azure services affect you. It can notify you, help you understand the impact of issues, and keep you updated as the issue is resolved.

What is the plus about Azure Service health :-

  • Azure Status provides a global view of the health state of Azure services
  • customizable dashboard that tracks the state of your Azure services in the regions where you use them.
  • Helps you diagnose and obtain support when an Azure service issue affects your resources

Cheers

And Enjoy the Cloud

Osama

Azure CLI For Beginners

What is Azure CLI ?

The Azure command-line interface (Azure CLI) is a set of commands used to create and manage Azure resources. The Azure CLI is available across Azure services and is designed to get you working quickly with Azure, with an emphasis on automation.

Documentation here

Create a Linux VM with the Azure CLI

The Azure CLI includes the vm command to work with virtual machines in Azure. We can supply several subcommands to do specific tasks. The most common include:

Sub-commandDescription
createCreate a new virtual machine
deallocateDeallocate a virtual machine
deleteDelete a virtual machine
listList the created virtual machines in your subscription
open-portOpen a specific network port for inbound traffic
restartRestart a virtual machine
showGet the details for a virtual machine
startStart a stopped virtual machine
stopStop a running virtual machine
updateUpdate a property of a virtual machine

Create new VM Using AZ CLI :-

az vm create --resource-group [resource group name] --location westus --name OsamaVM 
  --image UbuntuLTS --admin-username osama--generate-ssh-keys --verbose 

After creating the vmware , Public IP is assigned to create VM, to check the Public IP

Another way to check the IP by using the below command :-

az vm list-ip-addresses -n OsamaVM -o table

You could ports using AZ CLI for example

az vm open-port --port 80  --resource-group learn-9c22c502-355e-437b-9682-eb54b8c48e1c  --name OsamaVM

You can connect SSH to the VM Using the below command :-

There are pre defined image avaliable from Azure you can check them by :-

Or you can check the Avaliable Images in certain location, here you could find different between locations :-

For example also, the below command shows the images that has been created only By Microsoft :-

az vm image list --publisher Microsoft --output table --all

One More thing , To resize a VM, we use the vm resize command. For example, perhaps we find our VM is underpowered for the task we want it to perform. We could bump it up to a D2s_v3 where it has 2 vCores and 8 GB of memory. Type this command in Cloud Shell:

az vm resize --resource-group test-7223198d-cbdf-4fb7-bfd9-b609eaca3671 --name OsamaVM--size Standard_D2s_v3

Cheers

Enjoy

Osama