Skip to content

Commit

Permalink
Merge pull request #534 from lizwar/main
Browse files Browse the repository at this point in the history
Deploying applications to Arm64-powered Virtual Machine in Microsoft Azure - editorial checks complete
  • Loading branch information
pareenaverma authored Oct 19, 2023
2 parents 710c164 + a20b579 commit 275998a
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
---
title: 'From IoT to the Cloud: Deploying applications to Arm64-powered Virtual Machine in Microsoft Azure'
title: 'Deploying applications to Arm64-powered Virtual Machine in Microsoft Azure'

minutes_to_complete: 30

who_is_this_for: 'This learning path is dedicated to IoT developers interested in learning how to deploy applications to Microsoft Azure using Arm64-powered Virtual Machines, being a part of the Infrastructure as a Service offering.
who_is_this_for: 'This learning path is for IoT developers interested in learning how to deploy applications to Microsoft Azure using Arm64-powered Virtual Machines.
This learning path is the first part of the series: From IoT to the Cloud.'

learning_objectives:
- Create a Virtual Machine (VM) in Microsoft Azure.
- Connect to VM to install app dependencies, including SDK.
- Connect to the VM to install app dependencies, including SDK.
- Create and run the .NET application.
- Configure the network security group of the VM to expose the application over the Internet.

prerequisites:
- 'Azure subscription. Use this link to sign up for a free account: https://azure.microsoft.com/en-us/free/'
- 'A subscription to Azure. Use this link to sign up for a free account: https://azure.microsoft.com/en-us/free/'

author_primary: Dawid Borycki

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
next_step_guidance: Part 2

recommended_path: /learning-paths/PLACEHOLDER_CATEGORY/PLACEHOLDER_LEARNING_PATH/


# further_reading:
# - resource:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ review:
- Microsoft Firewall
correct_answer: 1
explanation: >
Network Security Group is the Azure resource you use to filter newtork traffic: https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview
[Network Security Group](https://learn.microsoft.com/en-us/azure/virtual-network/network-security-groups-overview) is the Azure resource you can use to filter network traffic.
- questions:
question: >
Expand All @@ -22,7 +22,7 @@ review:

correct_answer: 3
explanation: >
.NET CLI is the command-line tool you use to build and run applications. The tool is accessed by dotnet command. To run the application you use run subcommand. See here to learn more: https://learn.microsoft.com/en-us/dotnet/core/tools/
.NET CLI is the command-line tool you use to build and run applications. The tool is accessed by dotnet command. To run the application you use the run subcommand. See [this .NET CLI article](https://learn.microsoft.com/en-us/dotnet/core/tools) to learn more.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ layout: learningpathall
---

## Why arm64 in the cloud?
The general architecture of the Internet of Things includes various edge devices, which stream data to the central processing unit, which is deployed to the cloud.
The general architecture of the Internet of Things includes various edge devices which stream data to the central processing unit which, in turn, is deployed to the cloud.

As an IoT or Arm developer, you are already familiar with app development for your edge devices. Also, you know that arm64-powered devices offer power-efficient computations that enable us to achieve accelerated computing at reduced power consumption.

Cloud providers, including Microsoft Azure are now adopting this advantage. Specifically, Azure provides arm64-powered virtual machines, which you can use to deploy your apps to utilize arm64 power and reduce the carbon trace.
Cloud providers including Microsoft Azure are now adopting this technology. Specifically, Azure provides arm64-powered virtual machines which you can use to deploy your apps to utilize arm64 power and reduce the carbon trace.

This tutorial shows how to create the arm64-powered virtual machine in Microsoft Azure and use it for hosting a .NET application. The idea is to show you how to leverage Microsoft Azure, .NET, and aarch64 to build and host a central unit for your IoT solutions.
This tutorial demonstrates how to create the arm64-powered virtual machine in Microsoft Azure and use it for hosting a .NET application. The idea is to show you how to leverage Microsoft Azure, .NET, and aarch64 to build and host a central unit for your IoT solutions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,59 @@ layout: learningpathall
## Virtual Machine

### Virtual Machine Azure Resource
Let's start by creating the Virtual Machine. To do so, go to https://portal.azure.com and then sign in. You will see the screen which enables you to create Azure resources:
Let's start by creating the Virtual Machine. Go to https://portal.azure.com and sign in. You will see this screen which enables you to create Azure resources:
![Azure portal#left](figures/01.png "Figure 1. A fragment of the Azure Portal")

In the search box (which is on the top of the screen), type **VM**, and pick the first item on the list (Virtual machines):
In the search box, type **VM**, and pick the first item on the list (Virtual machines):
![Selecting Virtual Machine resource#left](figures/02.png "Figure 2. Selecting the virtual machine Azure resource")

In the Virtual machines, click **+ Create (top left corner)**, and then select **Azure virtual machine**:
In the Virtual machines, click **+ Create** (in the top left corner), and then select **Azure virtual machine**:
![Creating Virtual Machine#left](figures/03.png "Figure 3. Creating the virtual machine")

This will take you to the Create a Virtual Machine wizard, which looks as follows:
This takes you to the **Create a Virtual Machine** wizard as shown below:
![Creating Virtual Machine#left](figures/04.png "Figure 4. Virtual machine wizard")

### Virtual machine configuration
1. Subscription. Select your subscription.
2. Resource group. Click Create new link, then type **rg-arm64**, and click OK.
1. Subscription: select your subscription.
2. Resource group: click Create new link, then type **rg-arm64**, and click OK.
3. Virtual machine name: **vm-arm64**.
4. Region. Select East US (or any other, depending on your physical location).
5. Availability options. Select **No infrastructure redundancy required**.
4. Region: select depending on your physical location.
5. Availability options: select **No infrastructure redundancy required**.
6. Security type: **Standard**.
7. VM architecture: **arm64**.
8. Image: **Ubuntu Server 20.04 LTS – ARM64 Gen 2**.
9. Size:
* Click See all sizes.
* In the Select a VM size type **D2pds** in the search box
* Select **D2pds_v5**. Note that this size might not be available due to quota limits. In such a case click Request quota link (which will be located next to the VM size name). This will activate the New Quota Request, in which you type **2** under New limit and click Submit. Wait a few minutes for the quota limits to be updated.
* Click **See all sizes**.
* In the **Select a VM size** type **D2pds** in the search box
* Select **D2pds_v5**. *Note* that this size might not be available due to quota limits. If this happens, click **Request quota link** (which is located next to the **VM size** name). This will activate a New Quota Request. Type **2** under New limit and click Submit. Wait a few minutes for the quota limits to be updated.

At this point, your configuration should look as follows:
At this point, your configuration should look like this example:
![Creating Virtual Machine#left](figures/05.png "Figure 5. Virtual machine wizard (configured)")

Let's now configure other aspects of the Virtual Machine (Figure 6):
1. Administrator account. **Select Password**, and then populate other fields:
Let's now configure other aspects of the Virtual Machine:
1. Administrator account. **Select Password**, and then populate with:
* Username: **arm**
* Password: type your password. Make a note of this password. You'll need it to connect to VM.
* Confirm password: re-type your password.
* Password: type your password (make a note of this password as you'll need it to connect to VM)
* Confirm password: re-type your password
2. Inbound port rules. Keep them default: **SSH(22)**.

![Creating Virtual Machine#left](figures/06.png "Figure 6. Administrator account and inbound rules of the virtual machine")

Click the **Review + create** button. Azure Portal will validate your configuration, and you will see a green box saying: Validation passed:
Click the **Review + create** button. The Azure Portal will validate your configuration and, if all is correct, you will see a green box saying: **Validation passed**:

![Creating Virtual Machine#left](figures/07.png "Figure 7. A summary of the create virtual machine wizard")

Click the Create button. The portal will now start the process of creating your VM. You will notice that apart from the VM itself, the portal is creating additional resources for you:
* Public IP address you'll use it to connect to VM and then to see your application running,
* Network Security Group,
* Virtual network,
* Network interface,
* Virtual disk.
Click the Create button. The portal will now start the process of creating your VM. You will notice that apart from the VM itself, the portal creates additional resources for you:
* Public IP address (you'll need to use it to connect to the VM and then to see your application running)
* Network Security Group
* Virtual network
* Network interface
* Virtual disk

Wait a few moments for the deployment to be completed:
![Creating Virtual Machine#left](figures/08.png "Figure 8. A confirmation screen")

Finally, click the **Go to resource** button. You'll be redirected to the overview of your newly created virtual machine in Microsoft Azure:
![Creating Virtual Machine#left](figures/09.png "Figure 9. An overview of the virtual machine")

Note your Public IP address (top right part of the overview). In this tutorial, that is **52.149.156.228**.
Note your Public IP address (top right part of the overview). In this tutorial, this is **52.149.156.228**.
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ layout: learningpathall
---

## Objective
You'll now connect to the VM using SSH protocol and the public IP address of the virtual machine. Note that we will be using the public IP **52.149.156.228**. Please make sure to use the public IP of your virtual machine instead.
You will now connect to the VM using the SSH protocol and the public IP address of the virtual machine. *Note* that in this tutorial we will be using the public IP **52.149.156.228**. Please make sure to use the public IP of your virtual machine instead.

You can use a local terminal or the Azure Cloud Shell to connect to the VM. The latter is available straight from the Azure Portal. So you do not need to install additional tools. Therefore, in this tutorial, we use Cloud Shell.
You can use a local terminal or the Azure Cloud Shell to connect to the VM. The latter is available directly from the Azure Portal and to avoid installing additional tools, we will use the Cloud Shell.

### Azure Cloud Shell
To open the Cloud Shell, click a Cloud Shell icon located in the top right corner of Azure Portal:
To open the Cloud Shell, click on the Cloud Shell icon located in the top right corner of Azure Portal:
![Azure Cloud Shell#left](figures/10.png "Figure 10. A top right corner of the Azure Portal")

This will activate the new popup window, which appears at the bottom of Azure Portal:
This will activate a new popup window which appears at the bottom of the Azure Portal:
![Azure Cloud Shell#left](figures/11.png "Figure 11. Mounting a storage")

Click **Create storage**, and wait until the storage account is created. A Cloud Shell terminal should be ready. If it asks you for the interpreter, select Bash. The Cloud Shell terminal will look as follows
Click **Create storage**, and wait until the storage account is created. A Cloud Shell terminal should be ready. If it asks you for the interpreter, select **Bash**. The Cloud Shell terminal will look as follows:
![Azure Cloud Shell#left](figures/12.png "Figure 12. Cloud shell")

### Connecting to the Virtual Machine using Azure Cloud Shell
You will now use the Cloud Shell to connect to the VM via SSH. To do so, type (remember to use the Public IP address of your virtual machine):
You can now use the Cloud Shell to connect to the VM via SSH. To do so, type the Public IP address (remember to use the Public IP address of your virtual machine):

```console
ssh arm@52.149.156.228
```

This will initiate the connection with VM. The ssh will display the following message: Are you sure you want to continue connecting (yes/no/[fingerprint])? Type **yes**. Then provide your password to authenticate:
This will initiate the connection with the VM. The ssh will display the following message: Are you sure you want to continue connecting (yes/no/[fingerprint])? Type **yes**. Then provide your password to authenticate:
![Azure Cloud Shell#left](figures/13.png "Figure 13. Authentication")

You are now having terminal access to the VM. You'll use it in the next step to install application dependencies (.NET SDK).
You now have terminal access to the VM. You can use it in the next step to install application dependencies (.NET SDK).
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ layout: learningpathall

## Objective
In this step, you will install in the virtual machine the following tools:
.NET 7 SDK – to build and run the application,
git – to clone application sources.
- .NET 7 SDK – to build and run the application
- git – to clone application sources

Then, you will use git to clone applicaiton sources. Finally, you will build and launch the application.
Next, you will use git to clone application sources and finally, you will build and launch the application.

### Dependencies
To install .NET SDK:
Expand All @@ -29,50 +29,50 @@ chmod +x dotnet-install.sh
```console
./dotnet-install.sh --channel 7.0
```
4. Let's add .dotnet folder to the PATH by typing:
4. Add the .dotnet folder to the PATH by typing:
```console
export PATH="/home/arm/.dotnet/:$PATH"
```
5. To ensure that installation was successful, type:
5. To check that the installation was successful, type:
```console
dotnet --list-sdsk
```

Note that, in this tutorial, we installed .NET 7 because the application we will deploy was built using .NET 7. If you need to install another .NET version, modify the channel parameter of the installation script.
*Note* that, in this tutorial, we installed .NET 7 because the application we will deploy was built using .NET 7. If you need to install another .NET version, modify the channel parameter of the installation script.

To install git use the terminal of the virtual machine, where you type
To install git, use the terminal of the virtual machine and type:
```console
sudo apt-get install -y git-all
```

Wait for the installation to be completed. It will take a longer while.
Wait for the installation to be completed. It will take a while.

### Clone and run the application
You will now clone the application by typing:
```console
git clone https://github.com/dawidborycki/People.WebApp.git
```
The application sources will be cloned to People.WebApp folder. So, we change the working directory:
The application sources will be cloned to the People.WebApp folder. Change the working directory to:
```conolse
cd People.WebApp/
```
Then, we run the application such that it will listen on port 8080:
Then, run the application so that it will listen for requests on port 8080:
```console
dotnet run --urls "http://0.0.0.0:8080"
```
After completing this you will see the following output:
After completing this step, you will see the following output:

![Application#left](figures/14.png "Figure 14. Cloning and running the application")

The application is ready and listening for the requests on port 8080. However, the network traffic is blocked on all ports except 22. You will need to configure the Network Security Group to enable the traffic.

### Configure Network Security Group
To pass through the traffic on port 8080 for the Virtual Machine of name vm-arm64 you proceed as follows:
1. In the search box of Azure Portal, type **vm-arm64**, and select this resource.
2. In the vm-arm64 screen, click the Networking tab on the left (it's under Settings). You will see the following screen:
To allow traffic on port 8080 for the Virtual Machine **vm-arm64**, proceed as follows:
1. In the search box of the Azure Portal, type **vm-arm64** and select this resource
2. In the **vm-arm64** screen, click the **Networking** tab on the left (it's under **Settings**). You will see the following screen:
![Application#left](figures/15.png "Figure 15. Networking tab of the virtual machine")

In the Networking tab of the Virtual Machine, click the **Add inbound port rule** button (it's on the right). This will open a new popup window **Add inbound security rule**:
In the **Networking** tab of the Virtual Machine, click the **Add inbound port rule** button (it's on the right). This will open a new popup window **Add inbound security rule**:
![Application#left](figures/16.png "Figure 16. Adding inbound port rule")

Ensure the rule is configured as follows:
Expand All @@ -88,5 +88,5 @@ Ensure the rule is configured as follows:

Then, click **Add** and wait for the security rule to be applied.

Once this is done, open your web browser, and type the public IP address of your VM followed by 8080 port: **52.149.156.228:8080**. You'll see the application up and running:
![Application#left](figures/17.png "Figure 17. An application deployed to Azure virtual machine")
Once this is done, open your web browser and type the public IP address of your VM followed by 8080 port: **52.149.156.228:8080**. You'll see that the application is up and running:
![Application#left](figures/17.png "Figure 17. An application deployed to Azure virtual machine")
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ layout: learningpathall
---

## Summary
This tutorial taught you how to create an arm64-powered Virtual Machine in Microsoft Azure. Then, you connect to that VM using SSH and install the tools required to build and run the .NET web application. Finally, you learned how to configure a network security group to enable inbound traffic on port 8080.
This tutorial has shown you how to create an arm64-powered Virtual Machine in Microsoft Azure, how to connect to that VM using SSH, and how to install the tools required to build and run the .NET web application. Finally, you have learned how to configure a network security group to enable inbound traffic on port 8080.

0 comments on commit 275998a

Please sign in to comment.