Exercise - Create an Azure Batch job and virtual network

Completed

You can use the Azure portal to create and deploy Azure Batch jobs and create other Azure resources. The portal helps you choose the right properties that fit your compute scenario.

Note

This exercise is optional. If you want to complete this exercise, you'll need to create an Azure subscription before you begin. If you don't have an Azure account or you don't want to create one at this time, you can read through the instructions so you understand the information that's being presented.

Create a resource group

Create a resource group to hold a Batch account that you create later. You use the resource group to administer related services and applications together. A resource group also makes resource clean up easier when you finish this module.

To create a resource group in the Azure portal:

  1. Sign in to the Azure portal.

  2. On the left, select Create a resource.

  3. In the search box, type Resource and select Resource group from the results.

  4. Select Create to add a new resource group.

  5. On the Basics tab, select the subscription in which you want to work.

  6. Name the resource group BatchResourceGroup.

  7. Choose the region (location) for the resource group. Typically, you want a location that's close to you or close to the data you work with.

    Screenshot that shows how to create a resource group in the Azure portal.

  8. Select Review + create, then select Create.

Create a storage account

  1. On the Azure portal menu or from the home page, select Create a resource.

  2. Enter storage account in the Search services and marketplace search box, and then select Storage account.

  3. Select Create to open the Create storage account form.

    Screenshot of the form for creating a storage account on the Basics tab.

  4. For Subscription, select the appropriate subscription that you want to use.

  5. For Resource group, select the resource group that you created in the previous section (BatchResourceGroup).

  6. In the Storage account name box, enter a unique name. An example might be cutifypets<date><your initials>.

    Note

    Your storage account name must be globally unique, and only lowercase characters and numbers are allowed.

  7. Select a location close to you from the available options.

  8. Leave all the other options as their defaults. Select Review + create, then select Create.

  9. Wait for the deployment to finish. You now have a storage account that you use in your processing to store input and output files. You associate this storage account with your Batch account shortly.

Add input data

Here, you'll add input data for a Batch task that you'll use in the next exercise.

  1. Select Go to resource after the storage account deployment is complete.

  2. On the left, select Containers under Data storage.

  3. Select the + Container button to create a container. Name the container input-data and set the public access level as Private.

    Screenshot of the Containers page in the Azure portal, with the button for creating a container highlighted.

  4. Select Create.

  5. Download this video. You use it as input data for a Batch task shortly.

  6. Select the input-data container that you created. Upload the video that you downloaded by selecting the Upload button and browsing to where you downloaded the video. It's most likely your local Downloads folder.

  7. Once you select the video, select the Upload button.

Create a Batch account

Next, you create the Azure Batch account and pool in a virtual network for your test scenario.

  1. From the Azure portal home, select Create a resource.

  2. Enter batch service in the Search services and marketplace search box, then select Batch Service from the list.

  3. Select Create to open the New Batch account form.

  4. Enter the following settings on the Basics tab, in the Project details section:

    • Subscription: Select the appropriate subscription that you want to use.

    • Resource group: Select the name of the resource group that you created earlier (BatchResourceGroup).

    A screenshot of the page for creating a new Batch account in the Azure portal.

  5. Enter the following settings on the Basics tab, in the Instance details section:

    • Account name: A name that's unique within the Azure region where the account is created. The account name can contain only lowercase characters or numbers, and it must be 3 to 24 characters in length.

    • Location: The Azure region in which to create the Batch account. Only the regions your subscription and resource group support are displayed as options.

  6. On the Basics tab, in the Storage account section, select Select a storage account, then select the storage account that you created earlier.

    A screenshot of the dialog for creating a storage account in the Azure portal.

  7. Select Next: Advanced, and then enter the following settings on the Advanced tab:

    • Identity type: Leave as the default.

    • Pool allocation mode: Leave as the default, which should be Batch service.

    Note

    If you'd specified User subscription, Azure would create the pool in the subscription where you were creating your Batch service.

    A screenshot of the pool allocation mode selection on the Advanced tab when creating a Batch account in the Azure portal.

  8. Select Next: Networking. Leave Public network access as the default, which should be All networks.

  9. Leave all the other options as their defaults. Select Review + create, then select Create.

Your deployment might take a few minutes to finish.

Create a virtual network

After you create a virtual network and assigned a subnet to it, you can create a Batch pool with that virtual network. Follow these steps to create a pool from the Azure portal:

  1. From the Azure portal home, select Create a resource.

  2. Enter virtual network in the Search the Marketplace search box, and then select Virtual Network from the list.

  3. Select Create to open the Create virtual network form.

  4. Enter the following settings on the Basics tab, in the Project details section:

    • Subscription: Select the same subscription as your Batch account from previous steps.

    • Resource group: Select the same resource group as your Batch account from previous steps (BatchResourceGroup).

  5. Enter the following settings on the Basics tab, in the Instance details section:

    • Name: Enter a name for your virtual network.

    • Location: Select the same region as your Batch account from previous steps.

    A screenshot of the page for creating a virtual network in the Azure portal.

    Note

    If you had any unique IP address settings for your virtual network, you would select Next: IP Addresses and specify those settings on the IP Addresses tab.

  6. Leave all the other options as their defaults. Then select Review + create, followed by Create.

Create a Batch pool

  1. From the Azure portal home, select Resource groups, and then select the resource group that contains the Batch account (BatchResourceGroup).

  2. From your resource group Overview page, select your Batch account.

  3. Select Pools under Features in the left menu.

  4. In the Pools window, select + Add.

  5. In the Add Pool window, enter a name for Pool ID by using a combination of alphanumeric characters, hyphens, and underscores.

  6. For this exercise, specify the following options in the Operating System section:

    • Select Marketplace from the Image Type dropdown menu.

    • Select microsoftwindowsserver for Publisher.

    • Select windowsserver for Offer.

    • Select 2019-datacenter for Sku.

  7. For this exercise, select Standard A1 from the VM size dropdown menu.

  8. Set the Target dedicated nodes to 1, and set Target Spot/low-priority nodes to 0.

    To learn more about low-priority VMs, see Use low-priority VMs with Batch.

  9. For Virtual Network, select the virtual network that you created earlier.

  10. Specify any desired optional settings (or leave any other settings as their defaults), then select OK.