Skip to content

Commit 35e28b0

Browse files
committed
Article refresh 09 2024 - part 4
1 parent 3b8b9f7 commit 35e28b0

23 files changed

Lines changed: 354 additions & 347 deletions

azure-sql/database/auditing-setup.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ titleSuffix: Azure SQL Database & Azure Synapse Analytics
44
description: This article provides an overview of how to set up Auditing and storing those audits to an Azure storage account, Log Analytics workspace, or Event Hubs destination.
55
author: sravanisaluru
66
ms.author: srsaluru
7-
ms.reviewer: mathoma
8-
ms.date: 04/26/2023
7+
ms.reviewer: mathoma, vanto
8+
ms.date: 09/17/2024
99
ms.service: azure-sql-database
1010
ms.subservice: security
1111
ms.topic: conceptual
1212
---
1313
# Set up Auditing for Azure SQL Database and Azure Synapse Analytics
1414

15-
[!INCLUDE[appliesto-sqldb-asa](../includes/appliesto-sqldb-asa.md)]
15+
[!INCLUDE [appliesto-sqldb-asa](../includes/appliesto-sqldb-asa.md)]
1616

1717
In this article, we go over setting up Auditing for your logical server or database in [Azure SQL Database](sql-database-paas-overview.md) and [Azure Synapse Analytics](/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-overview-what-is).
1818

@@ -24,9 +24,9 @@ The default auditing policy includes the following set of action groups, which a
2424
- SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP
2525
- FAILED_DATABASE_AUTHENTICATION_GROUP
2626

27-
To configure auditing for different types of actions and action groups using PowerShell, see [Manage Azure SQL Database Auditing](auditing-manage-using-api.md).
27+
To configure auditing for different types of actions and action groups using PowerShell, see [Manage Azure SQL Database Auditing using APIs](auditing-manage-using-api.md).
2828

29-
Azure SQL Database and Azure Synapse Analytics Audit can store 4000 characters of data for character fields in an audit record. When the **statement** or the **data_sensitivity_information** values returned from an auditable action contain more than 4000 characters, any data beyond the first 4000 characters are **truncated and not audited**.
29+
Azure SQL Database and Azure Synapse Analytics Audit can store 4,000 characters of data for character fields in an audit record. When the **statement** or the **data_sensitivity_information** values returned from an auditable action contain more than 4000 characters, any data beyond the first 4000 characters are **truncated and not audited**.
3030

3131
The following section describes the Auditing configuration using the Azure portal.
3232

@@ -39,19 +39,19 @@ The following section describes the Auditing configuration using the Azure porta
3939
1. Navigate to **Auditing** under the **Security** heading in your **SQL database** or **SQL server** pane.
4040
1. If you prefer to set up a server auditing policy, you can select the **View server settings** link on the database auditing page. You can then view or modify the server auditing settings. Server auditing policies apply to all existing and newly created databases on this server.
4141

42-
:::image type="content" source="./media/auditing-overview/2_auditing_get_started_server_inherit.png" alt-text="Screenshot that shows the View server settings link highlighted on the database auditing page.":::
42+
:::image type="content" source="media/auditing-setup/auditing-get-started-server-inherit.png" alt-text="Screenshot that shows the View server settings link highlighted on the database auditing page." lightbox="media/auditing-setup/auditing-get-started-server-inherit.png":::
4343

4444
1. If you prefer to enable auditing on the database level, switch **Auditing** to **ON**. If server auditing is enabled, the database-configured audit exists side-by-side with the server audit.
4545

4646
1. You have multiple options for configuring where audit logs are stored. You can write logs to an Azure storage account, to a Log Analytics workspace for consumption by Azure Monitor logs, or to event hub for consumption using event hub. You can configure any combination of these options, and audit logs are written to each.
4747

48-
:::image type="content" source="./media/auditing-overview/auditing-select-destination.png" alt-text="Screenshot that shows the storage options for Auditing.":::
48+
:::image type="content" source="media/auditing-setup/auditing-select-destination.png" alt-text="Screenshot that shows the storage options for Auditing.":::
4949

5050
## Audit to storage destination
5151

5252
To configure writing audit logs to a storage account, select **Storage** when you get to the **Auditing** section. Select the Azure storage account where you want to save your logs. You can use the following two storage authentication types: **Managed Identity** and **Storage Access Keys**. For managed identity, system-assigned and user-assigned managed identity is supported. By default, the primary user identity assigned to the server is selected. If there's no user identity, then a system-assigned managed identity is created and used for authentication purposes. After you have chosen an authentication type, select a retention period by opening **Advanced properties** and selecting **Save**. Logs older than the retention period are deleted.
5353

54-
:::image type="content" source="./media/auditing-overview/auditing_select_storage.png" alt-text="Screenshot that shows storage account authentication types for Auditing.":::
54+
:::image type="content" source="media/auditing-setup/auditing-select-storage.png" alt-text="Screenshot that shows storage account authentication types for Auditing." lightbox="media/auditing-setup/auditing-select-storage.png":::
5555

5656
> [!NOTE]
5757
> If you are deploying from the Azure portal, make sure that the storage account is in the same region as your database and server. If you are deploying through other methods, the storage account can be in any region.
@@ -63,25 +63,25 @@ To configure writing audit logs to a storage account, select **Storage** when yo
6363

6464
To configure writing audit logs to a Log Analytics workspace, select **Log Analytics** and open **Log Analytics details**. Select the Log Analytics workspace where logs you want logs stored, and then select **OK**. If you haven't created a Log Analytics workspace, see [Create a Log Analytics workspace in the Azure portal](/azure/azure-monitor/logs/quick-create-workspace).
6565

66-
:::image type="content" source="./media/auditing-overview/auditing_select_oms.png" alt-text="Screenshot showing the Log Analytics workspace.":::
66+
:::image type="content" source="media/auditing-setup/auditing-select-log-analytics.png" alt-text="Screenshot showing the Log Analytics selected workspace." lightbox="media/auditing-setup/auditing-select-log-analytics.png":::
6767

6868
## Audit to Event Hubs destination
6969

7070
To configure writing audit logs to an event hub, select **Event Hub**. Select the event hub where you want logs stored, and then select **Save**. Be sure that the event hub is in the same region as your database and server.
7171

72-
:::image type="content" source="./media/auditing-overview/auditing_select_event_hub.png" alt-text="Screenshot showing the Event hub.":::
72+
:::image type="content" source="media/auditing-setup/auditing-select-event-hub.png" alt-text="Screenshot showing the Event hub." lightbox="media/auditing-setup/auditing-select-event-hub.png":::
7373

74-
> [!NOTE]
75-
> If you are using multiple targets like storage account , log analytics or event hub , make sure you have permissions for all the targets else saving audit configuration would fail as it will try to save the settings for all targets.
74+
> [!NOTE]
75+
> If you are using multiple targets like storage account , log analytics or event hub , make sure you have permissions for all the targets else saving audit configuration would fail as it will try to save the settings for all targets.
7676
7777
## Next steps
7878

7979
> [!div class="nextstepaction"]
8080
> [Use Auditing to analyze audit logs and reports](auditing-analyze-audit-logs.md)
8181
82-
## See also
82+
## Related content
8383

84-
- [Auditing overview](auditing-overview.md)
85-
- Data Exposed episode [What's New in Azure SQL Auditing](/Shows/Data-Exposed/Whats-New-in-Azure-SQL-Auditing)
86-
- [Auditing for SQL Managed Instance](../managed-instance/auditing-configure.md)
84+
- [Auditing for Azure SQL Database and Azure Synapse Analytics](auditing-overview.md)
85+
- [What's New in Azure SQL Auditing](/Shows/Data-Exposed/Whats-New-in-Azure-SQL-Auditing)
86+
- [Get started with Azure SQL Managed Instance auditing](../managed-instance/auditing-configure.md)
8787
- [Auditing for SQL Server](/sql/relational-databases/security/auditing/sql-server-audit-database-engine)

azure-sql/database/azure-sql-dotnet-quickstart.md

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@ title: Connect to and query Azure SQL Database using .NET and the Microsoft.Data
33
description: Learn how to connect to a database in Azure SQL Database and query data using .NET
44
author: alexwolfmsft
55
ms.author: alexwolf
6-
ms.reviewer: mathoma
7-
ms.custom: passwordless-dotnet
8-
ms.date: 07/11/2023
6+
ms.reviewer: mathoma, vanto
7+
ms.date: 09/17/2024
98
ms.service: azure-sql-database
109
ms.subservice: security
1110
ms.topic: quickstart
12-
monikerRange: "= azuresql || = azuresql-db"
11+
ms.custom: passwordless-dotnet
12+
monikerRange: "=azuresql || =azuresql-db"
1313
---
1414

1515
# Connect to and query Azure SQL Database using .NET and the Microsoft.Data.SqlClient library
16-
[!INCLUDE[appliesto-sqldb](../includes/appliesto-sqldb.md)]
16+
17+
[!INCLUDE [appliesto-sqldb](../includes/appliesto-sqldb.md)]
1718

1819
This quickstart describes how to connect an application to a database in Azure SQL Database and perform queries using .NET and the [Microsoft.Data.SqlClient](https://www.nuget.org/packages/Microsoft.Data.SqlClient) library. This quickstart follows the recommended passwordless approach to connect to the database. You can learn more about passwordless connections on the [passwordless hub](/azure/developer/intro/passwordless-overview).
1920

2021
## Prerequisites
2122

22-
* An [Azure subscription](https://azure.microsoft.com/free/dotnet/).
23-
* An Azure SQL database configured for authentication with Microsoft Entra ID ([formerly Azure Active Directory](/entra/fundamentals/new-name)). You can create one using the [Create database quickstart](./single-database-create-quickstart.md).
24-
* The latest version of the [Azure CLI](/cli/azure/get-started-with-azure-cli).
25-
* [Visual Studio](https://visualstudio.microsoft.com/vs/) or later with the **ASP.NET and web development** workload.
26-
* [.NET 7.0](https://dotnet.microsoft.com/download) or later.
23+
- An [Azure subscription](https://azure.microsoft.com/free/dotnet/).
24+
- An Azure SQL database configured for authentication with Microsoft Entra ID ([formerly Azure Active Directory](/entra/fundamentals/new-name)). You can create one using the [Create database quickstart](single-database-create-quickstart.md).
25+
- The latest version of the [Azure CLI](/cli/azure/get-started-with-azure-cli).
26+
- [Visual Studio](https://visualstudio.microsoft.com/vs/) or later with the **ASP.NET and web development** workload.
27+
- [.NET 7.0](https://dotnet.microsoft.com/download) or later.
2728

2829
## Configure the database
2930

@@ -41,7 +42,7 @@ For the steps ahead, create a .NET Minimal Web API using either the .NET CLI or
4142

4243
1. For the **Project Name**, enter *DotNetSQL*. Leave the default values for the rest of the fields and select **Next**.
4344

44-
1. For the **Framework**, select .NET 7.0 and uncheck **Use controllers (uncheck to use minimal APIs)**. This quickstart uses a Minimal API template to streamline endpoint creation and configuration.
45+
1. For the **Framework**, select .NET 7.0 and uncheck **Use controllers (uncheck to use minimal APIs)**. This quickstart uses a Minimal API template to streamline endpoint creation and configuration.
4546

4647
1. Choose **Create**. The new project opens inside the Visual Studio environment.
4748

@@ -61,7 +62,7 @@ For the steps ahead, create a .NET Minimal Web API using either the .NET CLI or
6162

6263
To connect to Azure SQL Database by using .NET, install `Microsoft.Data.SqlClient`. This package acts as a data provider for connecting to databases, executing commands, and retrieving results.
6364

64-
> [!NOTE]
65+
> [!NOTE]
6566
> Make sure to install `Microsoft.Data.SqlClient` and not `System.Data.SqlClient`. `Microsoft.Data.SqlClient` is a newer version of the SQL client library that provides additional capabilities.
6667
6768
## [Visual Studio](#tab/visual-studio)
@@ -96,7 +97,7 @@ The passwordless connection string sets a configuration value of `Authentication
9697

9798
For example, when the app runs locally, `DefaultAzureCredential` authenticates via the user you're signed into Visual Studio with, or other local tools like the Azure CLI. Once the app deploys to Azure, the same code discovers and applies the managed identity that is associated with the hosted app, which you'll configure later. The [Azure Identity library overview](/dotnet/api/overview/azure/Identity-readme#defaultazurecredential) explains the order and locations in which `DefaultAzureCredential` looks for credentials.
9899

99-
> [!NOTE]
100+
> [!NOTE]
100101
> Passwordless connection strings are safe to commit to source control, since they don't contain secrets such as usernames, passwords, or access keys.
101102
102103
## [SQL Authentication](#tab/sql-auth)
@@ -109,7 +110,7 @@ For local development with SQL Authentication to Azure SQL Database, add the fol
109110
}
110111
```
111112

112-
> [!WARNING]
113+
> [!WARNING]
113114
> Use caution when managing connection strings that contain secrets such as usernames, passwords, or access keys. These secrets shouldn't be committed to source control or placed in unsecure locations where they might be accessed by unintended users. During local development, on a real app, you'll generally connect to a local database that doesn't require storing secrets or connecting directly to Azure.
114115
115116
---
@@ -118,10 +119,10 @@ For local development with SQL Authentication to Azure SQL Database, add the fol
118119

119120
Replace the contents of the `Program.cs` file with the following code, which performs the following important steps:
120121

121-
* Retrieves the passwordless connection string from `appsettings.json`
122-
* Creates a `Persons` table in the database during startup (for testing scenarios only)
123-
* Creates an HTTP GET endpoint to retrieve all records stored in the `Persons` table
124-
* Creates an HTTP POST endpoint to add new records to the `Persons` table
122+
- Retrieves the passwordless connection string from `appsettings.json`
123+
- Creates a `Persons` table in the database during startup (for testing scenarios only)
124+
- Creates an HTTP GET endpoint to retrieve all records stored in the `Persons` table
125+
- Creates an HTTP POST endpoint to add new records to the `Persons` table
125126

126127
```csharp
127128
using Microsoft.Data.SqlClient;
@@ -221,9 +222,9 @@ The app is ready to be tested locally. Make sure you're signed in to Visual Stud
221222

222223
1) On the Swagger UI page, expand the POST method and select **Try it**.
223224

224-
1) Modify the sample JSON to include values for the first and last name. Select **Execute** to add a new record to the database. The API returns a successful response.
225+
1) Modify the sample JSON to include values for the `first` and `last` name. Select **Execute** to add a new record to the database. The API returns a successful response.
225226

226-
:::image type="content" source="media/passwordless-connections/api-testing-small.png" lightbox="media/passwordless-connections/api-testing.png" alt-text="A screenshot showing how to test the API.":::
227+
:::image type="content" source="media/passwordless-connections/api-testing-small.png" alt-text="Screenshot showing how to test the API." lightbox="media/passwordless-connections/api-testing.png":::
227228

228229
1) Expand the **GET** method on the Swagger UI page and select **Try it**. Choose **Execute**, and the person you just created is returned.
229230

@@ -243,11 +244,11 @@ The app is ready to be deployed to Azure. Visual Studio can create an Azure App
243244
* **Hosting Plan**: Select **New** to open the hosting plan dialog. Leave the default values and select **OK**.
244245
* Select **Create** to close the original dialog. Visual Studio creates the App Service resource in Azure.
245246

246-
:::image type="content" source="media/passwordless-connections/create-app-service-small.png" lightbox="media/passwordless-connections/create-app-service.png" alt-text="A screenshot showing how to deploy with Visual Studio.":::
247+
:::image type="content" source="media/passwordless-connections/create-app-service-small.png" alt-text="Screenshot showing how to deploy with Visual Studio." lightbox="media/passwordless-connections/create-app-service.png":::
247248

248249
1. Once the resource is created, make sure it's selected in the list of app services, and then select **Next**.
249250
1. On the **API Management** step, select the **Skip this step** checkbox at the bottom and then choose **Finish**.
250-
1. On the Finish step, select **Close** if the dialog does not close automatically.
251+
1. On the Finish step, select **Close** if the dialog doesn't close automatically.
251252

252253
1. Select **Publish** in the upper right of the publishing profile summary to deploy the app to Azure.
253254

@@ -273,9 +274,13 @@ When the deployment finishes, Visual Studio launches the browser to display the
273274

274275
3) Execute test GET and POST requests to verify that the endpoints work as expected.
275276

276-
> [!TIP]
277-
> If you receive a 500 Internal Server error while testing, it may be due to your database networking configurations. Verify that your logical server is configured with the settings outlined in the [Configure the database](/azure/azure-sql/database/azure-sql-dotnet-quickstart#configure-the-database) section.
277+
> [!TIP]
278+
> If you receive a 500 Internal Server error while testing, it might be due to your database networking configurations. Verify that your logical server is configured with the settings outlined in the [Configure the database](/azure/azure-sql/database/azure-sql-dotnet-quickstart#configure-the-database) section.
278279
279-
Congratulations! Your application is now connected to Azure SQL Database in both local and hosted environments.
280+
Your application is now connected to Azure SQL Database in both local and hosted environments.
280281

281282
[!INCLUDE [passwordless-resource-cleanup](../includes/passwordless-resource-cleanup.md)]
283+
284+
## Related content
285+
286+
- [Quickstart: Create an Azure SQL Database single database](single-database-create-quickstart.md)
Binary file not shown.
Binary file not shown.
Binary file not shown.
-83.7 KB
Binary file not shown.
Binary file not shown.
35.8 KB
Loading
17.2 KB
Loading
52.1 KB
Loading

0 commit comments

Comments
 (0)