Hey friend, you know that Azure app. Configuration externalize
your app settings, so that you can manage them more easily
from central location. It's built on the simple concept of
key value pairs Azure app. Configuration also includes
management utilities and integration with common
application. Frameworks and Jimmy Campbell is here to show
us how it works today on Azure Friday.
Hey friends I'm Scott Hanselman. It's Azure Friday. I'm learning
all about Azure app. Configuration Jimmy Campbell.
How are you Sir? I'm doing wonderfully? I'm happy to be
here today to talk about Azure app configuration fantastic? I
like doing Azure Friday because I learn about new stuff. New
features in Azure that I can then apply to the apps that I've
got 'cause. I got a bunch of apps service apps out there and
maybe you have been doing it wrong. All these years. Yeah,
I'm definitely excited because I think that this service will
definitely be able to help.
Then from what you're talking about it sounds like you'll be
able to use this right away. Fantastic yeah, right now. I
mostly just do things in the app settings or the configuration
section of the portal and I'm often times copy pasting just
configuration stuff environment variables actually got one
output in like 4 regions and I've got traffic Roger.
Open up 4 tabs and copy paste, yeah, you're trying to sync
things between applications. Another thing is, you may even
have your applications running on different platforms like a KS
and then you're running a function app. You have a whole
bunch of different parts to really build your solution and
you want to manage. Those yeah, you're making me realize that
I've got a virtual machine function and an Azure app
service and they all 3 exactly.
If you just had one spot that you could centralizes
applications with the capability to really query them at the app
level and make sure they're siloed independently and then we
were a service so we can give you things like manageability
showing you the history of your configuration things of that
nature. It really helps out with these large cloud scale
applications that are being developed and the worst part is
that I'm actually making it worse as I seem to think that we
see people do. In the industry is rather than me, putting in a
central location and pulling from it. I end up putting it in
scripts in my local machine and then I end up writing CLI code
to push configuration out to these different diverse places.
And it's just gross right so there are definitely different
patterns and best practices, pulling from the application is
one thing of course.
Deploying you know in your CI CD pipelines, you can use Azure
app. Configuration for variables and you know integrating into
frameworks platforms. CI CD pipelines, you name. The one
that you use that's our goal to really make this available in
any part of the solution that you're building OK now
everything is click, and it's like OK. I can figure it out.
'cause I've got the CI CD. I've got Azure DevOps Rock solid but.
More stuff copy pasted exactly right So what do you guys find
so let's let's talk about creating Azure configuration?
What the experience is like getting started an kind of what
it is so if you want to go ahead and get started with Azure app.
Configuration you can go to the Azure Portal Today with your
subscription. We have app
configuration. This is our
resource. Go ahead and create one of these and you're good to
go and so ultimately I have one created already. Although I have
to pay for this is just part of Azure. This right now is free.
You don't have to pay for this skewing. Maybe possibility right
now free to go. So just go ahead and create one and just use it.
I take it, yeah, go ahead.
Already have one created when you create Azure app.
Configuration what you're essentially getting at the core level is
a DNS endpoint rest. API and this thing is what you're using
to talk to you to create your key value settings, but of
course. We're not making you use the rest API have the portal CLI
and all? We need to really abstract that and handle it in
is it is it a private internal API or is it a public web. It's
documented API, so you can look at the rest documentation, and
it can I hit it from the outside of the world like the Internet?
Can hit it or is it something that I could put in AV net and
have it be private so right now, the net isn't supported for the
DNS. Do you see moving towards that so but right now you just
get your DNS and like you have your authentication of course,
so you do have API keys and that's how you would connect
perfect alright, so I created a Azure configuration, and let's
go ahead and get started looking at what exactly this looks like
in the portal? What are settings
look like? I'm just going to create a simple example here.
Let's say I have application. An I am showing something on the
screen, and it has a color so I have a color setting and I just
want to make that blue we do. Add metadata on top of this
setting content type. There's tags. But key value is the
simplest thing and so we see we created our first setting.
Bunch of these an well those would be your application
settings. One thing we see over here as well is label. So key
value and label is something that isn't so intuitive right
off the bat, but it's very important. This is a custom
dimension that a developer can use to let their configuration
involve for example.
He called color that I use my application, but maybe in North
America. People like green and in Europe. People like red all
of a sudden I see Oh my settings evolve across region. I'm
building a global application. So I want to use label is that
dimension. Other examples, maybe like version of the application
or SKU multi-tenancy Gold Silver Platinum. Whatever dimension you
want to mention you reference
those settings. But you may have a difference to change when the
application is deployed and that would be label or even AB
testing. I suppose, is exactly and let's go ahead and do an
example, So what did I say read
and North America. An Americans get one color and everybody else
gets another and then green and Europe. And so now. I kind of
have a dimensionalized configuration. My application
only knows it supposed to know about a color, but I can see
that I have this notion in North America. The color is red and
Europe. It's blue and by default
maybe. Europe is green and by default. Maybe it's blue right
right. I could go in creative created effectively scoping like
you said it's multidimensional data now and then I could fall
back and the one with no label. But then right right and you
would specify like? What label you want to use when you're
pulling your configuration and you could say pull Europe and
then pull no label to fill in the empty spot so you can kind
of a hierarchical. It's funny how something as simple as
metadata can go and make something like you said
multidimensional and much more for exactly and we let you
decide what dimension you want to use to scale across your
configuration alright. Let's talk about some utilities
because at the core were just key values. But we add
manageability on top of that you can see in the portal right now
compare settings. Repair configuration set to another
Azure app configuration.
I don't have one right now, but I can show you comparing across
Europe and North America. How did I forgot? How my
configuration differed oh I can see that the screen is a little
small but let me I've got this one application. I've got, I've
got one in Europe. I've got one in Japan. I've got one and North
now. You can see exactly what's different between them. I just
opened up multiple tabs it's a
mess. Well, this is going to solve that predict then OK cool,
so excited for this one OK. Alright so in the course. This
is all going to show you what got created there might be
things that exist in one and not the other will see that as well.
And then import export. I can put it in source control if I
wanted too absolutely so import
export. Right now we can do Jason file another other places
to import export 2, but will add to that as the time goes. We
want to come to where you are make it easy come to your
platforms or frameworks allow you to leave Congo with your
settings, so right now. I'm actually going to use this
'cause. I want to demo in ASP net core app that's going to
pool. OK, I have a Jason file sitting around right here. I'm
just going to go ahead and import. This JSON file in and
then use it in an application.
So let me import this.
Alright everything looks good. We imported it. Let's go back to
the key value Explorer and now we'll see some I got some
settings imported they're all starting with web demo as we can
see which is kind of like a best practice. I mentioned how we fix
Namespacing said how we could have multiple applications in
our Azure app, configurations
that point now. My web demo, I just take the keys that start
with web demo. That's what my my application is care about
anything else and if you were doing something with the game
with multi tenancy that could be a part of that dimension as well
right. But for the application. It's always using the setting by
the same name. So you wouldn't want the namespace seem to be
anything that changes
interesting OK. Think about it when you use it in code. It's
always supposed to stay the same label could be for things that
involve OK could cool so I have these settings here and now
let's go into the ASP net core code. I can show you we ship a
new get package called Microsoft extensions configuration dot
Azure app. Configuration and this is going to plug
into the .net core configuration kind of like you would expect it
with other can. It looks very natural eyes very online 26. You
go and just add it 'cause. It's an extension method and then
once you drop in the location that DNS that you mentioned
before that. AZ config dot. IO right so you can connect with
the connection string that is one supported method of course,
you get your connection with the portal actually one of the
beautiful things I get to do here is use manage identity for
Azure services. Well, I have to do is pass the identifier you
know the DNS name for my Azure app. Configuration and I'm just
going to connect. I don't have to worry about connection
strings, interesting so because it knows the manage identity of
that running in Azure. InASP.net got this extension that we
haven't even seen a connection. String you haven't tasted it
using your connection string my Azure configuration, gave
permission for my app service
to. Read key values I don't have to worry about connection.
That's pretty cool 'cause. You're actually bootstrapping
configuration without using configuration like there's no
config strings interview. That's pretty hot. I dig it. So this is
the name spacing. I talked about before I'm using a key filter
web demo and I'm watching and reloading all of my
configuration based on a certain key this is to help prevent
splicing. Want to change some settings. I want to change one
key and then have all the things shifted so that people are used
to changing configuration and then reloading the entire
application. But in a world of 5 nines. We can't be doing that.
We can't be restarting every time we change a webcam salute,
Lee and can't afford to do that. I mean, unless you're
orchestrator is really involved in that somehow but this is much
nicer sure going in pulling that at a user configurable poll
interval right. And what we're doing is we're going to bind
that to a data model for the purpose of this demo. We're
binding it to a simple data model where ultimately bringing
that data model to our razor page and then we're just going
to show some key values on the page or show some settings of
that model on the page. So I can show that we're getting the
settings and then we're going to see the settings change on the
fly. In this case here, you're actually dynamically generating
CSS S very nice is in line style share stories of pages love it.
That's very cool. Alright so let me go ahead. We have the
settings here and I have this application, which now is going
to be loading. Those settings when I reload it. So you can
see. I do have here data from Azure app configuration. I
didn't have that setting before but now that I loaded it and
reload. The page now. It's displaying but let's say.
Watching these settings, let's just go ahead and change it
because the Orange. Not really working for not really working
for me either. So we can go ahead and change the background
color here. It's just one of the things that happen to have
configurable and maybe I like Green, a little better today.
OK and then the font size is a little small so let's change
that one too. Just maybe 55 is a little bigger than 30 an this
message should be a little bit more personal 'cause. We're
feeling happy today on Friday, so how D?
From Azure Fridays :) next
month. All right now actually if I was a change this now. Nothing
is going to happen, because the Sentinel didn't change. You
know, we wanted to prevent the splicing so let me go ahead and
change that. Doesn't matter what it changes too? It's just
looking for it so it's it's pivoted on the Central Coast.
Actually, one of the things that I expected to happen. And I was
wrong was that I thought it was updating in on a timer an we'd
see depending on when you hit refresh. Some of them change and
not others chains and that for the last thing we want to
prevent this kind of we you can do that. If you know, but you
don't want it in a weird. State there's some things that are
dependent you can call. Watch and not watching real at all. It
will give you that behavior if that's what you wish but
ultimately, we don't want to call splicing in your
application is very thoughtful, so now? How do you from Azure
Fridays looks like I made the font a little too big so easily
fixed in configuration we can fix that right away, yeah, so
that's Azure app configuration, helping solve the manageability.
Ability an of the developers are facing today when they're
managing their applications across all these different
microservices platforms. You have your CI CD. So there's
that, so people can go an email. You and the team at Azure app,
config at microsoft.com then go check it out in the
documentation. It's all live right now. We saw some really,
really nice. Integration withASP.net core, but of course,
it's non denominational.
It works with any language that can talk rest, which is all of
them and were costly looking where the developers are aware
word coming so we're going to have right now. Of course, we
have the ISP not core net effects. Java spring cloud to
name a few so there's that and also integration with platform
so we see right now, we're
utilizing managed. Azure services, and we see we're
using app services function apps config maps and APS. We
see where we can come and make ourselves easy for you to
access fantastic alright well. I'm learning all about Azure
app configuration. I'm going to go back and change all my
apps and make them better now today on Azure Friday.