WEBVTT

1
00:00:00.690 --> 00:00:03.410
To end this hello world sample we're gonna

2
00:00:03.410 --> 00:00:07.630
be a bit more straightened about our security

3
00:00:07.630 --> 00:00:08.010
here.

4
00:00:08.430 --> 00:00:10.470
So what we're gonna do is we're gonna

5
00:00:10.470 --> 00:00:15.110
manage user secrets so we can store the

6
00:00:15.110 --> 00:00:17.690
secrets in a secret location.

7
00:00:18.250 --> 00:00:20.430
This is beyond the scope of the video

8
00:00:20.430 --> 00:00:23.750
how user secrets in general works in .NET,

9
00:00:24.350 --> 00:00:27.110
but let's just put them in here.

10
00:00:28.130 --> 00:00:32.950
Endpoint equals our endpoint here.

11
00:00:37.850 --> 00:00:39.810
And I'm using user secrets.

12
00:00:39.970 --> 00:00:42.330
You could use environment variables, you could use

13
00:00:42.330 --> 00:00:47.370
keyboards, all depending on what you normally feel

14
00:00:47.370 --> 00:00:50.170
is the correct way of securing your things.

15
00:00:50.170 --> 00:00:53.430
But I just want to have it in

16
00:00:53.430 --> 00:00:55.890
here as well so you don't leave your

17
00:00:55.890 --> 00:00:59.050
keys in clear text because that's an absolute

18
00:00:59.050 --> 00:01:02.190
no-no in 2026.

19
00:01:03.530 --> 00:01:07.330
So we just put them in here and

20
00:01:07.330 --> 00:01:11.850
then we write a little bit of code

21
00:01:11.850 --> 00:01:14.410
in order to get hold of them.

22
00:01:14.610 --> 00:01:17.270
So we're doing a configuration manager and adding

23
00:01:17.730 --> 00:01:22.470
our secrets here which is our programme and

24
00:01:22.470 --> 00:01:25.210
building an configuration manager.

25
00:01:29.100 --> 00:01:33.160
And that way we can say config get

26
00:01:33.160 --> 00:01:45.020
the endpoint we know it's okay config API

27
00:01:45.020 --> 00:01:50.720
key and we will check if it still

28
00:01:50.720 --> 00:01:51.260
works.

29
00:01:52.880 --> 00:01:58.340
So now our code is free of secrets

30
00:01:58.340 --> 00:02:02.320
and of course we now need to go

31
00:02:02.320 --> 00:02:05.620
up in in my case go up and

32
00:02:05.620 --> 00:02:08.380
delete the key because I've exposed the secret

33
00:02:08.380 --> 00:02:08.699
key.

34
00:02:09.479 --> 00:02:11.340
So I will delete it and create a

35
00:02:11.340 --> 00:02:13.780
new one for the following lectures.

36
00:02:15.620 --> 00:02:18.860
And up in Azure I would need to

37
00:02:18.860 --> 00:02:20.260
go to operate.

38
00:02:21.340 --> 00:02:22.820
I would need to go to admin.

39
00:02:23.940 --> 00:02:25.360
I would need to go to the parent

40
00:02:25.360 --> 00:02:29.620
resource of that project and manage it in

41
00:02:29.620 --> 00:02:32.320
Azure portal which I've done up here.

42
00:02:33.220 --> 00:02:35.620
I will go to resource management go to

43
00:02:35.620 --> 00:02:36.860
keys and endpoints.

44
00:02:38.380 --> 00:02:40.300
And here I would be able to regenerate

45
00:02:40.300 --> 00:02:44.240
the keys so they would not be exposed.

46
00:02:45.580 --> 00:02:49.560
So now we went from doing the absolute

47
00:02:49.560 --> 00:02:51.900
worst thing you can do putting API keys

48
00:02:51.900 --> 00:02:57.220
and stuff into your code to actually having

49
00:02:57.220 --> 00:02:57.860
it secure.

50
00:02:58.060 --> 00:03:00.400
Now again I need to regenerate some new

51
00:03:00.400 --> 00:03:02.660
ones and put them in instead of what

52
00:03:02.660 --> 00:03:04.920
we saw in here but these are invalid

53
00:03:04.920 --> 00:03:05.300
now.

54
00:03:06.460 --> 00:03:08.820
The endpoint as such is not a secret

55
00:03:08.820 --> 00:03:10.660
but I tend to put it here as

56
00:03:10.660 --> 00:03:16.060
well or into some application.JSON so it's

57
00:03:16.060 --> 00:03:19.160
not in code because then it's easier to

58
00:03:19.160 --> 00:03:20.080
replace.

59
00:03:21.800 --> 00:03:24.060
But that is the end of the hello

60
00:03:24.060 --> 00:03:24.420
world.

61
00:03:24.840 --> 00:03:28.000
Now we will go back into a bit

62
00:03:28.000 --> 00:03:31.420
more learning mode and looking into much more

63
00:03:31.420 --> 00:03:35.720
advanced things like more providers, more ways of

64
00:03:35.720 --> 00:03:37.140
doing chat and so on.

65
00:03:37.420 --> 00:03:41.360
Going back to the four key concepts of

66
00:03:41.360 --> 00:03:41.860
AI.
