Skip to content

Commit 30bb8f5

Browse files
committed
Merge branch 'master' of https://github.com/MicrosoftDocs/azure-docs-pr into tamram-0501a
2 parents 61dde66 + 745860b commit 30bb8f5

File tree

225 files changed

+1001
-801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+1001
-801
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Get resource events in Azure App Service
3+
description: Learn how to get resource events through Activity Logs and Event Grid on your App Service app.
4+
ms.topic: article
5+
ms.date: 04/24/2020
6+
ms.author: msangapu
7+
8+
---
9+
# Get resource events in Azure App Service
10+
11+
Azure App Service provides built-in tools to monitor the status and health of your resources. Resource events help you understand any changes that were made to your underlying web app resources and take action as necessary. Event examples include: scaling of instances, updates to application settings, restarting of the web app, and many more. In this article, you'll learn how to view [Azure Activity Logs](https://docs.microsoft.com/azure/azure-monitor/platform/activity-log-view) and enable [Event Grid](https://docs.microsoft.com/azure/event-grid/) to monitor resource events related to your App Service web app.
12+
13+
> [!NOTE]
14+
> App Service integration with Event Grid is in **preview**. [View the announcement for more details.](https://aka.ms/app-service-event-grid-announcement)
15+
>
16+
17+
## View Azure Activity Logs
18+
Azure Activity Logs contain resource events emitted by operations taken on the resources in your subscription. Both the user actions in the Azure portal and Azure Resource Manager templates contribute to the events captured by the Activity log.
19+
20+
Azure Activity Logs for App Service details such as:
21+
- what operations were taken on the resources (ex: App Service Plans)
22+
- who started the operation
23+
- when the operation occurred
24+
- the status of the operation
25+
- property values to help you research the operation
26+
27+
### What can you do with Azure Activity Logs?
28+
29+
Azure Activity Logs can be queried using the Azure portal, PowerShell, REST API, or CLI. You can send the logs to a storage account, Event Hub, and Log Analytics. You can also analyze them in Power BI or create alerts to stay updated on resource events.
30+
31+
[View and retrieve Azure Activity log events.](https://docs.microsoft.com/azure/azure-monitor/platform/activity-log-view)
32+
33+
## Ship Activity Logs to Event Grid
34+
35+
While Activity logs are user-based, there's a new [Event Grid](https://docs.microsoft.com/azure/event-grid/) integration with App Service (preview) that logs both user actions and automated events. With Event Grid, you can configure a handler to react to the said events. For example, use Event Grid to instantly trigger a serverless function to run image analysis each time a new photo is added to a blob storage container.
36+
37+
Alternatively, you can use Event Grid with Logic Apps to process data anywhere, without writing code. Event Grid connects data sources and event handlers. For example, use Event Grid to instantly trigger a serverless function to run image analysis each time a new photo is added to a blob storage container.
38+
39+
### Supported Event Types
40+
| Event Type |Description|
41+
| -----------| ------------- |
42+
| Microsoft.web/sites | (Webapp) |
43+
| BackupOperationCompleted |Backup of the webapp completed successfully|
44+
| BackupOperationFailed | Backup of the webapp failed|
45+
| RestoreOperationStarted |Restore from backup has started|
46+
| RestoreOperationCompleted |Restore from backup completed successfully|
47+
| RestoreOperationFailed |Restore from backup failed|
48+
| SlotSwapStarted |Slot swap has started|
49+
| SlotSwapCompleted |Slot swap completed successfully|
50+
| SlotSwapFailed |Slot swap failed|
51+
| SlotSwapWithPreviewStarted |Slot swap with preview has started|
52+
| SlotSwapWithPreviewCancelled |Slot swap with preview failed|
53+
| AppUpdated | |
54+
| Restarted | The webapp was restarted |
55+
| Stopped | The webapp was stopped |
56+
| ChangedAppSettings | App settings on the webapp were changed |
57+
| - | - |
58+
| Microsoft.web/serverfarms | (App Service Plan) |
59+
| AspUpdated | The app service plan was updated. The event object contains details on the properties that were changed. |
60+
| Scale up/down | The app service plan scaled up or down. The event object contains the instance count.|
61+
62+
63+
## <a name="nextsteps"></a> Next steps
64+
* [Query logs with Azure Monitor](../azure-monitor/log-query/log-query-overview.md)
65+
* [How to Monitor Azure App Service](web-sites-monitor.md)
66+
* [Troubleshooting Azure App Service in Visual Studio](troubleshoot-dotnet-visual-studio.md)
67+
* [Analyze app Logs in HDInsight](https://gallery.technet.microsoft.com/scriptcenter/Analyses-Windows-Azure-web-0b27d413)

articles/app-service/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@
200200
href: web-sites-monitor.md
201201
- name: Enable logs
202202
href: troubleshoot-diagnostic-logs.md
203+
- name: Get resource events
204+
href: get-resource-events.md
203205
- name: Manage app
204206
items:
205207
- name: Manage the hosting plan

articles/azure-app-configuration/howto-labels-aspnet-core.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
---
22
title: Use per-environment configuration
33
titleSuffix: Azure App Configuration
4-
description: Use labels to provide per-environment configuration values
4+
description: Use labels to provide per-environment configuration values.
55
ms.service: azure-app-configuration
66
author: lisaguthrie
77
ms.topic: conceptual
88
ms.date: 3/12/2020
99
ms.author: lcozzens
1010

1111
---
12-
# Use labels to enable different configurations for different environments
12+
# Use labels to enable configurations for different environments
1313

14-
Many applications need to use different configurations for different environments. Suppose that an application has a configuration value that defines the connection string to use for its back-end database. The application's developers use a different database from the one used in production. The database connection string used by the application must change as the application moves from development to production.
14+
Many applications need to use different configurations for different environments. Suppose that an application has a configuration value that defines the connection string to use for its back-end database. The application developers use a different database from the one used in production. The database connection string that the application uses must change as the application moves from development to production.
1515

16-
In Azure App Configuration, you can use *labels* to define different values for the same key. For example, you can define a single key with different values for *Development* and *Production*. You can specify which label(s) to load when connecting to App Configuration.
16+
In Azure App Configuration, you can use *labels* to define different values for the same key. For example, you can define a single key with different values for development and production. You can specify which label to load when connecting to App Configuration.
1717

18-
To demonstrate this functionality, we'll modify the web app created in [Quickstart: Create an ASP.NET Core app with Azure App Configuration](./quickstart-aspnet-core-app.md) to use different configuration settings for development vs. production. Please complete the quickstart before proceeding.
18+
To demonstrate this functionality, you'll modify the web app created in [Quickstart: Create an ASP.NET Core app with Azure App Configuration](./quickstart-aspnet-core-app.md) to use different configuration settings for development versus production. Complete the quickstart before proceeding.
1919

2020
## Specify a label when adding a configuration value
2121

22-
In the Azure portal, go into **Configuration Explorer** and locate the *TestApp:Settings:FontColor* key that you created in the quickstart. Select its context menu and then click **Add Value**.
22+
In the Azure portal, go to **Configuration Explorer** and find the *TestApp:Settings:FontColor* key that you created in the quickstart. Select its context menu and then select **Add Value**.
2323

2424
> [!div class="mx-imgBorder"]
2525
> ![Add Value menu item](media/labels-add-value.png)
2626
2727
On the **Add Value** screen, enter a **Value** of **red** and a **Label** of **Development**. Leave **Content type** empty. Select **Apply**.
2828

29-
## Loading configuration values with a specified label
29+
## Load configuration values with a specified label
3030

31-
By default, Azure App Configuration only loads configuration values with no label. If you've defined labels for your configuration values, you'll want to specify the label(s) to use when connecting to App Configuration.
31+
By default, Azure App Configuration only loads configuration values with no label. If you've defined labels for your configuration values, you'll want to specify the labels to use when connecting to App Configuration.
3232

33-
In the last section, you created a different configuration value for the *Development* environment. You use the `HostingEnvironment.EnvironmentName` variable to dynamically determine which environment the app is currently running in. To learn more, see [Use multiple environments in ASP.NET Core](/aspnet/core/fundamentals/environments).
33+
In the previous section, you created a different configuration value for the development environment. You use the `HostingEnvironment.EnvironmentName` variable to dynamically determine which environment the app currently runs in. To learn more, see [Use multiple environments in ASP.NET Core](/aspnet/core/fundamentals/environments).
3434

3535
Load configuration values with the label corresponding to the current environment by passing the environment name into the `Select` method:
3636

@@ -54,13 +54,13 @@ Load configuration values with the label corresponding to the current environmen
5454
```
5555

5656
> [!IMPORTANT]
57-
> The above code snippet loads the App Configuration connection string from an environment variable called `AppConfigConnectionString`. Be sure that this environment variable is set properly.
57+
> The preceding code snippet loads the App Configuration connection string from an environment variable named `AppConfigConnectionString`. Be sure that this environment variable is set properly.
5858
59-
The `Select` method is called twice. The first time, it loads configuration values with no label. Then, it loads configuration values with the label corresponding to the current environment. These environment-specific values override any corresponding values with no label. You do not need to define environment-specific values for every key. If a key does not have a value with a label corresponding to the current environment, then the value with no label is used.
59+
The `Select` method is called twice. The first time, it loads configuration values with no label. Then, it loads configuration values with the label corresponding to the current environment. These environment-specific values override any corresponding values with no label. You don't need to define environment-specific values for every key. If a key doesn't have a value with a label corresponding to the current environment, it uses the value with no label.
6060

61-
## Testing in different environments
61+
## Test in different environments
6262

63-
To test the different configuration values, open the `launchSettings.json` file under the `Properties` directory. Locate the `config` entry under `profiles`. In the `environmentVariables` section, set the `ASPNETCORE_ENVIRONMENT` variable to `Production`.
63+
Open the `launchSettings.json` file under the `Properties` directory. Find the `config` entry under `profiles`. In the `environmentVariables` section, set the `ASPNETCORE_ENVIRONMENT` variable to `Production`.
6464

6565
With the new values set, build and run your application.
6666

@@ -69,11 +69,13 @@ dotnet build
6969
dotnet run
7070
```
7171

72-
Use a web browser to navigate to `http://localhost:5000`. You'll notice that the font color is black.
72+
Use a web browser to go to `http://localhost:5000`. You'll notice that the font color is black.
7373

7474
![Web application running with production configuration](media/labels-website-prod.png)
7575

76-
Now update `launchSettings.json` to set the `ASPNETCORE_ENVIRONMENT` variable to `Development`. Run `dotnet run` again. You'll notice that the font color is now red. This is because the application now uses the value of `TestApp:Settings:FontColor` that has the `Development` label. All other configuration values remain the same as their production values.
76+
Update `launchSettings.json` to set the `ASPNETCORE_ENVIRONMENT` variable to `Development`. Run `dotnet run` again.
77+
78+
You'll notice that the font color is now red. This is because the application now uses the value of `TestApp:Settings:FontColor` that has the `Development` label. All other configuration values remain the same as their production values.
7779

7880
![Web application running with development configuration](media/labels-website-dev.png)
7981

0 commit comments

Comments
 (0)