Setting Up Your Development Environment
Welcome to the first chapter! This chapter will guide you through the steps to set up your development environment and create your first Azure project.
We will start by discussing how to create your Azure subscription, which is the first step in getting started with Azure development. We will provide you with a step-by-step guide on setting up your subscription, including selecting the right subscription type and configuring your account settings.
Next, we will dive into configuring your development environment. This includes setting up your machine with the software, tools, and dependencies required for Azure development. We will guide you through this process, ensuring you have a well-configured environment.
After that, we will set up your Visual Studio for success. Visual Studio is a robust integrated development environment (IDE) that provides the tools to build, test, and deploy your Azure projects. We will show you how to configure Visual Studio for Azure development, including how to set up your project templates and debugging tools.
Finally, we will walk you through creating your first project in Azure. We will provide a hands-on approach, guiding you through creating a new Azure project, setting up your project structure, and deploying your project to the cloud.
In this chapter, we will cover the following main topics:
- Creating your Azure subscription
- Configuring your development environment
- Setting up your Visual Studio for success
- Creating your first project
By the end of this chapter, you will have a solid understanding of how to create your Azure subscription, configure your development environment, set up Visual Studio for success, and create your first Azure project. So, let’s get started!
Creating your Azure subscription
- Open the browser, and navigate to https://azure.microsoft.com/en-in/free/.
Figure 1.1 – Create your free Azure account screen
- Click on the Start free button. On the second screen, you need to create an account. Click on the Create one! link.
Figure 1.2 – Azure account setup – signing in with a live account/signing up for a live account
- You can use either your existing email address or you can create a new email address. We are using the existing email option.
Figure 1.3 – Creating a live account – email address
- You need to create a password for your account and complete some CAPTCHA verification to create the account. Once it is completed, you will be redirected to an Azure account creation screen.
Figure 1.4 – Azure account profile creation
- On the screen, you need to provide your personal details, contact information, and your credit card information – for verification purposes. For verification purposes, $2 from your card will be charged and it will be credited to your card within one to two days.
Once the signup is successfully completed, you will be able to see the success page as follows. From this screen, you will be able to access the Azure portal.
Figure 1.5 – Azure account creation – success page
- Click on the Go to Azure portal button to access the Azure portal and you will be able to see a screen like this.
Figure 1.6 – Azure portal
The preceding screenshot shows the Azure portal where you can create and manage resources.
- In the portal, you can search for resources in the middle search bar, which will help you to search for resources have you created; the available Azure services that you can create; the Marketplace, which you can use to access resources from third-party providers; and documentation on the Azure service you are looking for.
- In this example, I am searching for
Storagesince there is no storage account created. It does not show any existing resources, but the portal shows me services such as Azure Storage Account and Storage browser, and then it shows some Marketplace suggestions and finally, the documentation related to the
Figure 1.7 – Searching for resources – the Azure portal
- In the portal, after the search bar, you can see a Cloud Shell icon, which helps you execute commands in either PowerShell or Bash shell – you can use this feature to create resources using the command line.
Figure 1.8 – Cloud Shell icon – Azure portal
- The Directories + Subscriptions icon will help you switch between different active directories and subscriptions.
Figure 1.9 – Directories + Subscriptions – Azure portal
Figure 1.10 – Directories + Subscriptions page – Azure portal
- In the portal, the notifications icon will show different notifications, such as remaining credit, resource provisioning status, and so on.
Figure 1.11 – Notifications – Azure portal
Figure 1.12 – Settings – Azure portal
Clicking on the settings icon will take you portal settings page where we have the following options:
- By default, it will open the Directories + Subscriptions page.
- You can click on the Appearance + startup views menu to configure the look and feel of the portal. In this section, you can also configure the first screen in terms of what you see on it when you log in.
Figure 1.13 – Configure appearance and startup view – Azure portal
Figure 1.14 - Setting up language, date, and currency format – Azure portal
- The My information section displays your email address and helps you to subscribe to different emails from Microsoft. You will be able to Export settings, which helps to export your current Azure portal configuration as a JSON file. The Delete all settings and private dashboards option helps you to remove all the settings and dashboards created.
Figure 1.15 – My information – Azure portal
- Finally, the Signing out + notifications page helps you to configure notifications and sign-out options.
Figure 1.16 – Signing out and notifications configuration – Azure portal
- Click on the Support + troubleshooting icon to learn about the health status of different Azure services. Also, you will be able to see different links to access billing FAQs, documentation, and the technical community.
Figure 1.17 – The Support and troubleshooting option – Azure portal
Figure 1.18 – Send feedback – Azure portal
Figure 1.19 – Azure portal
You can customize this menu, which will help you to access different services quickly. The Azure portal comes with a Dashboard view as well. You will be able to create different dashboards and share them with your other team members.
Figure 1.20 – Azure portal
- Click on the Dashboard button to see your private dashboard – by default, it will show as My Dashboard.
Figure 1.21 – Dashboard view – Azure portal
- You can customize the dashboard. You can click on the Edit button, and on the screen, you can remove existing widgets and add different widgets.
Figure 1.22 – Customizing the dashboard – Azure portal
- Upon completing the customization, you can preview the changes, and then you will be able to save the changes by clicking on the Save button. You can share the dashboard with other users in the subscription using the Share button.
Figure 1.23 – Share dashboard – Azure portal
Creating resources in the Azure portal
- You need to click on the + Create a resource button.
Figure 1.24 – Azure portal – + Create a resource
Figure 1.25 – Azure portal – Create a resource
For demo purposes, I will create a resource group. It’s a container that contains related resources in an Azure solution. It is a best practice to create resources related to a project or product in the same resource group. You can search for
resource group and click on the first result. Then, you will be able to see the details of the service/resource you’re about to create.
Figure 1.26 – Azure portal – new resource group
- Click on the Create button.
- On the Create a resource group screen, provide the name of the resource group –
HelloWorld– set Subscription to Free Trial, and set Region to a region near your location.
Figure 1.27 – Azure portal – Create a resource group – Basics screen
- Click on the Review + create button to view the details of the resource you’re going to create, and then create the resource upon confirmation by clicking the button again. In the case of a resource group, you will only see the configuration values you created, but in the case of certain resources such as virtual machines or app services, you need to configure mandatory fields – then, you can click on Review + create – in such a scenario, you will be able to see the default values on this screen.
Or you can assign tags to the resource on the Tags tab. Tags are key-value pairs that act as metadata for Azure resources, which helps you to identify resources. Tags are helpful for tracking, organizing, grouping, and analyzing costs for resources. It is a best practice to add tags to your Azure resources.
Figure 1.28 – Azure portal – associating tags
- Upon clicking the Review + create button again, you will be able to see the details of the resources and the tags:
Figure 1.29 – Azure portal – Create a resource group confirmation screen
- Once you click on the Create button, Azure will create the resource group and you will get a notification.
Figure 1.30 – Azure portal – Resource created notification
This way, you will be able to create resources in the Azure portal. Now you have learned how to create an account and create a free trial subscription in Azure portal. You also learned about how to create resources in Azure using the Azure portal. You will be able to create resources using the Azure CLI and Azure PowerShell as well. Next, you will learn about configuring your development environment.
Configuring your development environment
Setting up your development environment is essential for success because it provides you with the necessary tools and resources to efficiently and effectively develop, test, and deploy your software. A properly configured development environment allows you to streamline your workflow, automate tasks, and catch errors early on in the development process. If you’re new to coding, I’m sure you’re wondering how to set up the right environment for you so that you can get coding quickly and easily. You want to be able to focus on what matters most: creating great code!
There are many different ways to do this, but here is a simple guide that will show you how to set up an IDE for .NET programming on Azure. This guide will give you a solid foundation upon which you can build your knowledge of Python and other programming languages.
If you already have an environment setup, please note we will be working through examples utilizing .NET 6.0 in this book and that needs to be installed on your machine. If you are starting from scratch, follow the instructions below to get started.
Installing .NET 6.0
- Open your browser and go to this web page: https://dotnet.microsoft.com/en-us/download/dotnet. We will primarily be working in .NET 6.0 so make sure to choose the option related to the system you are using.
Figure 1.31 – .NET Download page
- You need to download the .NET 6.0 SDK. Once the Software Development Kit (SDK) has been downloaded, execute the downloaded executable, which will bring up the following setup screen.
Figure 1.32 – .NET SDK – Windows installation
On Mac machines, it will show a welcome screen like this.
Figure 1.33 – .NET SDK – Mac installation
In Linux distributions, .NET SDK supports two types of installation – manual installation and script installation. With manual installation, we need to download the .NET SDK, execute the files, and configure paths. In script installation, we can download a .NET installation script from here: https://dot.net/v1/dotnet-install.sh. For developers or normal users, scripted installation is recommended. Once we have downloaded the script, we need to make it executable using the
chmod command, and then execute the script.
Here are the bash commands to do this:
> wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh > chmod +x ./dotnet-install.sh > ./dotnet-install.sh
This will install the .NET 6.0 SDK in most of the Linux distributions. You can find more details about the installation here: https://learn.microsoft.com/dotnet/core/install/linux?WT.mc_id=DT-MVP-5002040.
Setting up your local environment for Azure development
You need to set up and configure the development environment for building your applications in .NET and Azure. In this section, you will configure Visual Studio Code (VS Code) and Visual Studio. Visual Studio Code is an open source editor for building ASP.NET Core and C# applications.
Installing Visual Studio Code
- Visit the Microsoft site to download Visual Studio Code: https://visualstudio.microsoft.com/downloads/
Figure 1.34 – Visual Studio/VS Code download page
Figure 1.35 – VS Code – download page
- Accept the terms and conditions and continue with the installation:
Figure 1.36 – VS Code Editor
- Unlike on Windows and Mac, installing VS Code on Linux is easy – we just need to run the following command:
sudo snap install --classic code. This will install VS Code on Linux. For more information on the VS Code installation, check out this page: https://code.visualstudio.com/docs/setup/linux.
- Click on Extensions or press the Ctrl + Shift + X shortcut keys on Windows or Cmd + Shift + X on Mac and install the following extensions:
Installing Visual Studio Community 2022
- Visit the Microsoft site to download Visual Studio: https://visualstudio.microsoft.com/downloads/
Figure 1.37 – Visual Studio download page
- Install Azure Development and the accompanying packages for .NET development; the Visual Studio setup will prompt for different installation configurations or workloads.
Figure 1.38 – Visual Studio – installation configuration
Figure 1.39 – Visual Studio – first screen
In this section, you learned about installing and configuring your development environment. VS Code is a cross-platform editor for debugging applications and Visual Studio is a fully featured IDE for building and debugging applications.
Creating your first project
After installing all of the prerequisite software listed in step 2, under the Installing Visual Studio Community 2022 section, you should be able to begin building them without the need for any extra settings. To get things going, we’ll write a straightforward function that we’ll attempt to execute to make sure everything is set up and prepared. Start up Visual Studio 2022 Community Edition and select Create a new project to get started.
Figure 1.40 – Visual Studio – welcome screen
Now you can select an Azure Function from the list of choices and follow the steps to get started with the project. On the first screen, configure your new project screen. We need to set the project name, project location, and solution name. On the Additional information screen, we need to configure the framework, function trigger, and authorization level. Please see the following configuration values:
Figure 1.41 – Visual Studio – creating an Azure Functions app
After you click the OK button, you should see a screen similar to the following screenshot (see Figure 1.42). This indicates that a new function file has been created, and some standard code has already been added as a starting point. We will discuss how to create a function and its properties in the chapter of this book specifically related to Azure Functions (Chapter 5). For now, we won’t go into too much detail.
Figure 1.42 – Azure Functions project in Visual Studio
This is how, we can create an Azure Function using Visual Studio. We can other project types such as ASP.NET Core MVC, Blazor, and ASP.NET Core Web APIs. We will explore other project types in the upcoming chapters. Visual Studio will also help us to debug, deploy, and monitor the applications in Azure.
Congratulations on completing your first chapter on your Azure development journey! By now, you should have a solid understanding of how to set up your development environment, configure Visual Studio for Azure development, and create your first Azure project. These skills will serve as a foundation for your future Azure development work.
Remember, Azure is a powerful cloud platform with many services and solutions. By continuing to learn about and explore Azure, you can take advantage of its many benefits, including scalability, flexibility, and cost savings.
We hope this chapter has provided you with a valuable introduction to Azure development and inspired you to continue learning and exploring the world of cloud computing. The next chapter will dive deeper into Azure services and show you how to develop applications using some core services. In the next chapter, you will learn about containers, installing Docker, and building applications with container support. So, stay tuned and keep learning!