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.
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!
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.
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
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
Restart Visual Studio Code and next time we will create a local Azure Function!
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.
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!
After Visual Studio Code is installed press the following command on your keyboard.
Search in Markeplace for Azure Account and press install.
After Aure Account is installed press ctrl+shit+p again and type
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!
In this series we will look closer at how you can use Azure with Visual Studio Code.
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.
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!
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.
Let’s configure an App Service for a custom domain in the last blog post.