Stopping and starting Azure resources

As noted several times throughout this cookbook, not all Azure resources or services are free; in fact, most of them represent commercial services (after all, Azure is hosted by a private company that—just like your organization, or you personally—while offering services to its clients for payment, represents a client to numerous other vendors, who also expect to be paid for their services).

In a production environment, where services are delivered to paying customers, you would normally only stop your resources during maintenance, or when they have been discontinued. However, in a development and testing environment, with no paying customers, you may wish to stop your resources simply to reduce cost.

Important note

Not every Azure resource can be suspended—some can only be deallocated when the resource that they are part of is deallocated, and some will only be deallocated when the resource they are a part of is deleted, or when they themselves are removed completely.

Getting ready

You are going to sign into your Azure subscription, locate the VMs used by your Big Data Cluster, and suspend them. You will finish the recipe by learning how to start them again.

Right now, your principal objective is to learn how to suspend the VMs. You will follow the second part of this recipe only when you actually need access to the Big Data Cluster in later recipes.

How to do it…

Use your favorite internet browser to log in to the Azure portal at https://portal.azure.com/.

  1. On the Home page of the subscription you used in the previous recipe, entitled Creating a SQL Server 2019 Big Data Cluster, open the menu on the left, and locate the All resources item:

    Figure 3.9 – Accessing All resources on the Azure portal

  2. In the list of all your resources, locate the VM Scale Set (VMSS) that you created earlier (there should only be one) and follow the link to the resource's Overview page.

    The name of the VMSS used to host the Big Data Cluster that you created earlier in this chapter should begin with aks-nodepool1- and end with -vmss:

    Figure 3.10 – Accessing the VMSS of an Azure Kubernetes installation

    In the resource menu ribbon (not the browser menu, of course), click Deallocate.

  3. A warning should appear, telling you that all of the VM instances will be deallocated when you deallocate the VMSS.

    As this is exactly what you want to do right now, click Yes to continue.

  4. In the left column, under Settings, click Instances, to open information about the VM instances used by your Big Data Cluster.

    It should take a few minutes for the VMs to be suspended.

    In the resource menu, click Refresh to observe the current state of the instances:

    Figure 3.11 – The deallocated VM instances

    Once the VMs have been suspended, their status should be Stopped (deallocated). This means that your Big Data Cluster instance is offline and is no longer contributing to the cost of your subscription.

  5. To start the Big Data Cluster again, you do this either by starting each of the VMs on the Instances page or by starting the entire VMSS on the Overview page.

    For instance, on the VMSS Instances page, check the box before each VM.

    Click Start, and the VMs should now return to their saved states. Depending on the size of the machines, it should take about a minute for them to return to a Running state.

    Important note

    By using the Restart command instead of Start, the VMs will be turned off and restarted, and will not return to the state they were in before being suspended; a restart might also take significantly longer to complete. Only use Restart if you want the machines to be restarted without returning to their saved states.

    For the purposes of this recipe, and most recipes in this cookbook for that matter, simply starting the VMs from their suspended state should be enough—after all, it was probably you who suspended them in the first place.

    After the VMs have come back online, it might still take a few minutes until the services hosted on them come online as well. You can monitor those in ADS, by connecting to the Big Data Cluster. In the Connections pane, under SQL Server Big Data Clusters, right-click the node representing your Big Data Cluster instance and select Manage from the shortcut menu.

    If your Big Data Cluster instance is not listed in the Connections pane, see Step 11 of the first recipe in this chapter, entitled Creating a SQL Server 2019 Big Data Cluster, for further information.

How it works…

By deallocating Azure resources, all operations running on them will be suspended (or, depending on the individual resource, stopped altogether). This, of course, also affects all services and operations that depend on the deallocated resources—for instance, any dependent services or processes might fail when the resource becomes unavailable. Therefore, you should use caution when stopping Azure services or deallocating resources.

When a resource is deallocated, it will no longer use some of the resources assigned to it (such as CPUs or system memory) but might still use other resources (for instance, disk space). Suspended and deallocated resources no longer contribute to the cost of Azure subscriptions, whereas resources that cannot be suspended (and, therefore, not deallocated) will remain active, which will be reflected in the subscription cost.

Tip

More information about the costs associated with using Azure is available in the online documentation, at https://azure.microsoft.com/en-us/pricing/.