Development Features and Tricks
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.
- Azure Functions
- Visual Studio Code
About this video
- Sahil Malik
- First online
- 20 December 2019
- Online ISBN
- Copyright information
- © Sahil Malik 2019
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.
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.
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.