Create an Azure Function using Visual Studio Code Part 4 – Deploy function to Azure

Now let’s upload this function to Azure to use online!

Go into the Azure extension and press on sign in to Azure.

After you have logged in press on the Deploy to function app.

Select create a new function app in Azure, create a global unique name and select a region.

Once done check if it’s complete by pressing the bell button.

Next jump into Azure and get the function URL and check out your function app in Azure!

But wait a minute, now our code is wrong! It’s in Azure right? Let’s push an update in the next blog post!

Create an Azure Function using Visual Studio Code Part 3 – Edit the code and pass a query string

Last time we had our Azure Function with C# and deployed and tested it. Let’s go into the function code and make a change and pass a query string and watch our function reply.

Go into the project folder and change the text after hello to say

"on my local environment!"

Launch the debugging again and append below to your string.

?name=DonaldDuck

There you go! Now in the next post we will deploy to Azure!

Create an Azure Function using Visual Studio Code Part 2 – Create a local Azure Function Project

Last time we installed both the Azure Function extension for Visual Studio Code and the local Azure Functions Core tools. This time we’ll create a local Azure Function and try it out!

In Visual Studio Code select the extension and create a new project and browse and create a new folder.

Select C# as language and select httptrigger as the template.

Finally give it a namespace.

Set the access level to anonymous.

Start debugging.

You’ll find the path to your Azure Function running in the console window. Visit the site and enjoy your local Azure Function!

In the next tutorial we will customize the function and change the reply by passing a query string!

Create an Azure Function using Visual Studio Code Part 1 – Download Clients

With an Azure subscription you get access to alot of free products, with a new Azure account some are free for 12 months and after that you can use more than 25 free products with a limit on the amount of traffic or other limits. Read here!

So let’s create a free Azure function that includes at the moment 1 million requests and 400,000 Gbs of resource consumption. You can read more about how to configure Azure Functions here.

Now first search in Visual Studio Code extensions for Azure Functions and install it.

Next we want to develop locally as well so let’s download and install the Azure Functions Core Tools here.

Restart Visual Studio Code and next time we will create a local Azure Function!

Using Azure from Visual Studio Code Part 3 – Set context and change appearance

As a bonus we will add a specfic subscription so we don’t have to define it in every command and change the layout of VSCode.

You can choose how you like to view your terminal. Go to view, appearance and toggle panel position for a vertical view.

Now let’s se the context to default a subscription.

Get the subscription id by below command.

get-azsubscription

Add your subscription to a variabel by getting it from the get-command

$SubscriptionID = Get-AzureRMSubscription | Where-Object
Name -like '*minsubscription*'

Now you have your subscription in a variable and you can define it’s context by below command.

Set-AzureRmContext -SubscriptionID $SubscriptionID

There we go! Now start to use Azure from Visual Studio Code!

Using Azure from Visual Studio Code Part 2 – Download Azure Account extension

After Visual Studio Code is installed press the following command on your keyboard.

ctrl+shift+p

Next write

install extensions

Search in Markeplace for Azure Account and press install.

After Aure Account is installed press ctrl+shit+p again and type

Azure:sign in

Wait for the browser to open and display that you’re logged in.

Once signed in press the same command again and type

Azure:open PowerShell in Cloud Shell

You can also use the same command to open bash.

A terminal will open up and now you’re signed in with your account!

Congrats! You can now use AZ from your own computer!

Using Azure from Visual Studio Code Part 1 – Download VSCode

In this series we will look closer at how you can use Azure with Visual Studio Code.

Go to https://code.visualstudio.com/#alt-downloads and download the version that suits your OS.

After download start the installation and complete.

Press finish to start Visual Studio Code!

In the next part we’ll install an Visual Studio Code extensions for access to the AZ powershell module for Azure.

Custom domain name in Azure Part 3 – Add a custom domain to a App Service.

Now in this last part we will add the custom domain!

When the DNS zone has been updated and redirected, verify first, it’s time to update your app service.

Head over to the App Service and note hostname and IP.

Go to the DNS Zone and add an A-record with @ that redirects to the IP-adress of your web app and a TXT for the hostname for your azure sites hostname.

Now go back into the App Service to custom domain and validate.

There you go! A custom hostname for your app service!

Custom domain name in Azure Part 2 – Redirect an external registrar to Azure DNS

Now we will let Azure act as our DNS name server instead of the delegated from our registrar.

Go to your DNS Zone and copy the four DNS servers you’ve received for your DNS.

Login to your registrar and change DNS to your Azure DNS.

Done!

Let’s configure an App Service for a custom domain in the last blog post.