Create an ASP.NET Core web app with Azure App Configuration

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome back to our Channel my name is balram Prasad and I'm working with Microsoft as a single software engineer in this video we are going to see how we can create Azure app configuration and integrate with asp.net core web app and we will deploy that to app service June app configuration is service which is generally used for centrally managed application settings in feature flag so if you remember previously we used to have web.conf where we were keeping application related setting and depending upon environment we could have multiple web config with web dot Dev dot config or app.dev.com settings files different file for different kind of application we used to have and then once you have to in keeping all these secrets and configuration in code is not a good way to keep that in Microsoft Azure we have two services to use this one one is app configuration and one is keyword so whatever key in secret related thing is there we should keep with key Vault whatever configuration related things are there or settings we can go with the Azure app configuration so for this demo we are into Azure portal and we are inside Resource Group web app in config demo so first we are going to create app config resource in app configuration in app configuration allow developer to store the trip manage access to application configuration in one place and it is globally unique name so I will keep that so please test with app config let me keep that and it is going to be standard or free we can use that one free inside free jio duplication and soft deleted notes supported so let's go for free only because we do not need all this feature an access point is automatic another details right now we can keep whatever default is being provided by Azure let's go and review and click that quickly now our resource has been created let's go to this resource so this is our app configuration and in configuration Explorer we can create key value pair in key Vault reference and also in feature manager we can Define the feature like what are the different feature we are building enable or disabled you have heard about the name the featured flags and feature of toggling and other things we can use this feature in for test in production if some feature we want to enable for a particular set of user also that kind of things we can do it from here and let's go inside visual studio and let's create a web app so I'm going to create a new project and I'm going to select asp.net core web app let me go ahead and give a name and this is.net6 authentication is right now none and we are configuring for https we are not enabling Docker so let me go ahead and create and now we have to go ahead and install a nuget package let me go ahead and it will be that Microsoft Zoo dot app configuration.sp.net code so I'm going to install this package and once the package is installed we can go ahead and add few lines of code after Builder so when it is Builder is being created it is going to get the config connection string app config and it is going to add this feature inside our configurations so this is one provider it will be there it will go ahead and get the details from App config so uh right now we are using connection string but for better security we can use managed identity so let me go ahead and grab the connection string first in connection string we can go into access key and then we can get this connection string and for safer also we can use that read only connection strings let me go ahead and get that one so inside our app config I am going to put the edgy connection strings and this will be our connection string where we can have one or more I am going to put that App config because we are using App config for that case and I can put the debug point also here before that now I can go ahead inside Pages section in any any Pages if we have to inject that I configurations right now if you go into index model I logger is being injected I can go and say that I configuration right and I can get this injected if I go ahead and say that let me grab this detail and take an assign to local variable and now if I want to see that one running let's me go into config expert let me add it key value config one and paste it apparently then config let me apply this I'm going to say that okay let me put the debug point I just wanted to test that it is it coming or not so now if we see we are able to read connection string for our app config and it is going to add this configuration and first page the index post loaded if we go ahead and see that configuration there are providers there are seven providers in one provider is our app configuration provided restage environment variable Json provideration configuration provider in that if we explore we have data equals to 1 and we can see this value is coming from that one and if we go down we can see that this value is coming let's add few more key over there let's add test setting and this is how that we can add this section also instead of single variable and let me include that variable equals to White let me put another one I'm going to create one class create new class for City because I wanted to read the section a setting section and if we see that we have given the test app that's sitting in other things so I'm going to create this section class and this section class is where background from font size font color message another thing is coming now we can go inside our once again into program files and in program files where we are injected our app configuration after that one we can say that hey I wanted to do this setting one and setting is what class we defined that you go ahead and read this section from this configuration config provider test app settings and put inside in settings and then once we go ahead inside our index classes then we can have we you must know that if you are working on that one this is is option snapshot is one of the city which provided by asp.net core where we can inject any now once we go that we can also set that because now it has been injected I can go ahead and save this value that he whatever options are coming option value put into settings so this is what it is going to be and then index dot setting let's modify a little bit of index setting and then we can use this whatever value is coming and this is how this value will look like that model whatever model we have right now is going to come and we are going to use background color model settings model is this our model right model is this and then model dot settings and other things is going to read inside this one font color font size message let's go ahead and run this go inside and see that what is the settings let's see that settings it is injected it went ahead pulled down from that app configuration and did that one this is how it looks like that our page is coming and now let's go ahead and deploy this page to our app Services I am going to publish this webpage foreign Resource Group which we created web app config demo so I'm going to create a new hosting plan location so location let's keep at Central India let's go ahead and see that where we created our app configuration so our app configuration is to use so let's keep the base right now and then I am going to click OK and then I am going to create this web app now we can go and say finish close now let's publish now we can see this page is deployed let's browse this let's see if comes up or it fails this is right now coming so this is the website and if we go inside our div Resource Group we can see this page and we can browse from here also and let's browse this page and we are able to see now if you see that one uh if we wanted to enable manage the identity we can go enable managed identity and then related code we need to go ahead and change that one where we have to say that with it you want to use with Azure identity and other things that little bit code you need to tweak and that's how we can make more secure over there and also for dynamic enabling Dynamic configuration we need to make some changes inside only one place and then it will work so I will create another video for that one I hope you will like that [Music] foreign
Info
Channel: SoftWiz Circle
Views: 2,031
Rating: undefined out of 5
Keywords: azure app configuration, deploy .net core web api to azure app service, deploy asp.net core web api to azure, visual studio publish api to azure, app configuration, feature flags, deploy rest api to azure app service, configuration in asp.net core, azure app configuration service, deploy asp.net core api to azure, app service configuration in azure, azure app configuration feature flags, azure app configuration service feature flags, azure app configuration c#
Id: Tr5r9gk_l2s
Channel Id: undefined
Length: 11min 24sec (684 seconds)
Published: Wed Mar 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.