Advanced Scenarios in Azure Functions

Deployment Experience

Your browser needs to be JavaScript capable to view this video

Try reloading this page, or reviewing your browser settings

This video segment shows how to manage deployment and view streaming logs from Azure in VSCode.

Keywords

  • Azure
  • Azure Functions
  • Visual Studio Code
  • VSCode

About this video

Author(s)
Sahil Malik
First online
20 December 2019
DOI
https://doi.org/10.1007/978-1-4842-4408-1_10
Online ISBN
978-1-4842-4408-1
Publisher
Apress
Copyright information
© Sahil Malik 2019

Video Transcript

Sahil Malik: Now that we have written, developed and debugged an Azure Function right through VSCode, let’s look at the deployment experience. In order to deploy directly from VSCode, make sure that you sign in with an Azure subscription here. Right from here, you can choose to create a function app in Azure or you can open in Portal. So let me show you both of these. When I click here, I’m required to type in a globally unique name for the function app. This is equivalent to, say, using the Azure CLI, et cetera, to be able to create a function app. The problem is we don’t know what names exist. This will certainly work as long as you give it a unique name, but what I’m going to do instead is that I’m going to go to the Azure Portal. I’m already signed in and I’m going to click on this Create a Resource button and I’m going to go ahead and create a function app.

Go ahead and select Function App, click on Create. And these steps, you’ve seen these many times over, give it a name, give it a resource group, go down here. What’s important is make sure you pick a runtime matching your project. Otherwise, things will deploy and everything will seem to work but the function won’t start. So make sure that you pick JavaScript if you’re targeting JavaScript. Click on the Create button and in a minute or so, this function app will get created. Let’s wait for this to finish.

Once my function app is created, as you see here it’s done, I’m going to go back to VSCode and I’m going to hit this Refresh button. See this progress thing here? My function app is discovered in here. Just make sure you’re signed in to the correct Azure subscription and that you have the necessary filters activated if you have more than one subscription attached to your live I.D. Now here, let’s see what functions exist in here. Well, currently none because we haven’t created one and we haven’t deployed one. Let’s see if the portal agrees with us. So I’m going to go into the resource groups here and here I have the function app, and here it’s thinking and I have no functions here as expected, right.

Okay, now I’m going to go in here, go to my function and I’m going to say right click, deploy the function app, pick the function app I’d like to deploy to, and click on deploy. It gives me this big scrolling output over here. And if this is the first time you’ve done this, it’ll also install a bunch of NuGet packages for C# which, even though I’m working with JavaScript, it still does that. That’s okay. Don’t be alarmed if you see that. But in a moment, this thing will finish and ideally, if there are no authentication issues or anything like that, your function will be deployed in the function app. Let’s give it a moment to finish.

In a few short seconds, you should see an output like this. Let’s scroll through here. You can also come to this area here and then refresh here and see my HttpTrigger shows up here. This is exactly what I expect. Now there are a lot of different ways of getting your code into Azure Functions. Source control is another way. And I’ve talked about that in other courses but here I can deploy without having to go through source control. Let’s go to the Azure Portal and see if we see the function there as well. Let’s go here. I’m going to hit refresh and yeah, the HttpTrigger shows up here. Isn’t that nice?

Okay, so the very same code shows up here. Now what I can do, I can go back here and I can say right click, copy the function URL or I can choose to delete the function right from here as well. So see, full manageability right from here. Now I’m going to say, start streaming logs. Remember that I’ve already copied the URL. Let’s open this a little bit. I’m going to open the browser now. Let’s open a new tab and let’s make sure we have that window in focus. Let’s make this a little bit smaller. And I’m going to paste the URL for the HttpTrigger, hit enter and you see here that I can even see streaming logs here. Let’s hit refresh one more time, more logs. So see, right through Visual Studio Code I can deploy and manage my entire function app and I can even view logs coming right from Visual Studio Code.