You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can configure [System.Diagnostics.Tracing.EventSource](https://msdn.microsoft.com/library/system.diagnostics.tracing.eventsource.aspx) events to be sent to Application Insights as traces. First, install the `Microsoft.ApplicationInsights.EventSourceListener` NuGet package. Then edit the `TelemetryModules` section of the [ApplicationInsights.config](../../azure-monitor/app/configuration-with-applicationinsights-config.md) file.
@@ -129,17 +133,21 @@ You can call the Application Insights trace API directly. The logging adapters u
129
133
130
134
For example:
131
135
132
-
var telemetry = new Microsoft.ApplicationInsights.TelemetryClient();
An advantage of TrackTrace is that you can put relatively long data in the message. For example, you can encode POST data there.
136
142
137
143
You can also add a severity level to your message. And, like other telemetry, you can add property values to help filter or search for different sets of traces. For example:
138
144
139
-
var telemetry = new Microsoft.ApplicationInsights.TelemetryClient();
140
-
telemetry.TrackTrace("Slow database response",
141
-
SeverityLevel.Warning,
142
-
new Dictionary<string,string> { {"database", db.ID} });
This would enable you to easily filter out in [Search][diagnostic] all the messages of a particular severity level that relate to a particular database.
Copy file name to clipboardExpand all lines: articles/azure-sql/database/elastic-query-horizontal-partitioning.md
+14
Original file line number
Diff line number
Diff line change
@@ -43,10 +43,12 @@ These statements create the metadata representation of your sharded data tier in
43
43
44
44
The credential is used by the elastic query to connect to your remote databases.
45
45
46
+
```sql
46
47
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'password';
47
48
CREATE DATABASE SCOPED CREDENTIAL <credential_name> WITH IDENTITY = '<username>',
48
49
SECRET = '<password>'
49
50
[;]
51
+
```
50
52
51
53
> [!NOTE]
52
54
> Make sure that the *"\<username\>"* does not include any *"\@servername"* suffix.
@@ -55,6 +57,7 @@ The credential is used by the elastic query to connect to your remote databases.
55
57
56
58
Syntax:
57
59
60
+
```sql
58
61
<External_Data_Source> ::=
59
62
CREATE EXTERNAL DATA SOURCE <data_source_name> WITH
60
63
(TYPE = SHARD_MAP_MANAGER,
@@ -63,9 +66,11 @@ Syntax:
63
66
CREDENTIAL = <credential_name>,
64
67
SHARD_MAP_NAME = ‘<shardmapname>’
65
68
) [;]
69
+
```
66
70
67
71
### Example
68
72
73
+
```sql
69
74
CREATE EXTERNAL DATA SOURCE MyExtSrc
70
75
WITH
71
76
(
@@ -75,10 +80,13 @@ Syntax:
75
80
CREDENTIAL= SMMUser,
76
81
SHARD_MAP_NAME='ShardMap'
77
82
);
83
+
```
78
84
79
85
Retrieve the list of current external data sources:
80
86
87
+
```sql
81
88
select * from sys.external_data_sources;
89
+
```
82
90
83
91
The external data source references your shard map. An elastic query then uses the external data source and the underlying shard map to enumerate the databases that participate in the data tier.
84
92
The same credentials are used to read the shard map and to access the data on the shards during the processing of an elastic query.
@@ -87,6 +95,7 @@ The same credentials are used to read the shard map and to access the data on th
Copy file name to clipboardExpand all lines: articles/azure-sql/database/elastic-scale-split-merge-security-configuration.md
+23-2
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,10 @@ If those options are not available, you can generate **self-signed certificates*
41
41
42
42
If installed, go to:
43
43
44
-
%ProgramFiles(x86)%\Windows Kits\x.y\bin\x86
44
+
```console
45
+
%ProgramFiles(x86)%\Windows Kits\x.y\bin\x86
46
+
```
47
+
45
48
* Get the WDK from [Windows 8.1: Download kits and tools](https://msdn.microsoft.com/windows/hardware/gg454513#drivers)
46
49
47
50
## To configure the TLS/SSL certificate
@@ -187,12 +190,14 @@ This topic is for reference only. Follow the configuration steps outlined in:
187
190
## Create a self-signed certificate
188
191
Execute:
189
192
193
+
```console
190
194
makecert ^
191
195
-n "CN=myservice.cloudapp.net" ^
192
196
-e MM/DD/YYYY ^
193
197
-r -cy end -sky exchange -eku "1.3.6.1.5.5.7.3.1" ^
194
198
-a sha256 -len 2048 ^
195
199
-sv MySSL.pvk MySSL.cer
200
+
```
196
201
197
202
To customize:
198
203
@@ -203,7 +208,9 @@ To customize:
203
208
## Create PFX file for self-signed TLS/SSL certificate
204
209
Execute:
205
210
206
-
pvk2pfx -pvk MySSL.pvk -spc MySSL.cer
211
+
```console
212
+
pvk2pfx -pvk MySSL.pvk -spc MySSL.cer
213
+
```
207
214
208
215
Enter password and then export certificate with these options:
209
216
@@ -226,7 +233,9 @@ Upload certificate with the existing or generated .PFX file with the TLS key pai
226
233
## Update TLS/SSL certificate in service configuration file
227
234
Update the thumbprint value of the following setting in the service configuration file with the thumbprint of the certificate uploaded to the cloud service:
Copy file name to clipboardExpand all lines: articles/azure-sql/database/elastic-scale-upgrade-client-library.md
+2
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,7 @@ Performing these steps in order ensures that old versions of the client library
53
53
54
54
Alternatively, create a Visual Studio application that opens your ShardMapManager, iterates over all shards, and performs the metadata upgrade by calling the methods [UpgradeLocalStore](https://docs.microsoft.com/dotnet/api/microsoft.azure.sqldatabase.elasticscale.shardmanagement.shardmapmanager.upgradelocalstore) and [UpgradeGlobalStore](https://docs.microsoft.com/dotnet/api/microsoft.azure.sqldatabase.elasticscale.shardmanagement.shardmapmanager.upgradeglobalstore) as in this example:
55
55
56
+
```cssharp
56
57
ShardMapManager smm =
57
58
ShardMapManagerFactory.GetSqlShardMapManager
58
59
(connStr, ShardMapManagerLoadPolicy.Lazy);
@@ -63,6 +64,7 @@ Alternatively, create a Visual Studio application that opens your ShardMapManage
63
64
{
64
65
smm.UpgradeLocalStore(loc);
65
66
}
67
+
```
66
68
67
69
These techniques for metadata upgrades can be applied multiple times without harm. For example, if an older client version inadvertently creates a shard after you have already updated, you can run upgrade again across all shards to ensure that the latest metadata version is present throughout your infrastructure.
Copy file name to clipboardExpand all lines: articles/azure-sql/database/elastic-scale-working-with-dapper.md
+8
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,7 @@ The shard map object creates a connection to the shard that holds the shardlet f
81
81
82
82
Queries work very much the same way - you first open the connection using [OpenConnectionForKey](https://msdn.microsoft.com/library/azure/dn807226.aspx) from the client API. Then you use the regular Dapper extension methods to map the results of your SQL query into .NET objects:
83
83
84
+
```csharp
84
85
using (SqlConnectionsqlconn=shardingLayer.ShardMap.OpenConnectionForKey(
85
86
key: tenantId1,
86
87
connectionString: connStrBldr.ConnectionString,
@@ -98,6 +99,7 @@ Queries work very much the same way - you first open the connection using [OpenC
98
99
Console.WriteLine(item.Name);
99
100
}
100
101
}
102
+
```
101
103
102
104
Note that the **using** block with the DDR connection scopes all database operations within the block to the one shard where tenantId1 is kept. The query only returns blogs stored on the current shard, but not the ones stored on any other shards.
103
105
@@ -106,6 +108,7 @@ Dapper comes with an ecosystem of additional extensions that can provide further
106
108
107
109
Using DapperExtensions in your application does not change how database connections are created and managed. It is still the application’s responsibility to open connections, and regular SQL Client connection objects are expected by the extension methods. We can rely on the [OpenConnectionForKey](https://msdn.microsoft.com/library/azure/dn807226.aspx) as outlined above. As the following code samples show, the only change is that you no longer have to write the T-SQL statements:
108
110
111
+
```csharp
109
112
using (SqlConnectionsqlconn=shardingLayer.ShardMap.OpenConnectionForKey(
110
113
key: tenantId2,
111
114
connectionString: connStrBldr.ConnectionString,
@@ -114,9 +117,11 @@ Using DapperExtensions in your application does not change how database connecti
114
117
varblog=newBlog { Name=name2 };
115
118
sqlconn.Insert(blog);
116
119
}
120
+
```
117
121
118
122
And here is the code sample for the query:
119
123
124
+
```csharp
120
125
using (SqlConnectionsqlconn=shardingLayer.ShardMap.OpenConnectionForKey(
121
126
key: tenantId2,
122
127
connectionString: connStrBldr.ConnectionString,
@@ -130,12 +135,14 @@ And here is the code sample for the query:
130
135
Console.WriteLine(item.Name);
131
136
}
132
137
}
138
+
```
133
139
134
140
### Handling transient faults
135
141
The Microsoft Patterns & Practices team published the [Transient Fault Handling Application Block](https://msdn.microsoft.com/library/hh680934.aspx) to help application developers mitigate common transient fault conditions encountered when running in the cloud. For more information, see [Perseverance, Secret of All Triumphs: Using the Transient Fault Handling Application Block](https://msdn.microsoft.com/library/dn440719.aspx).
136
142
137
143
The code sample relies on the transient fault library to protect against transient faults.
@@ -145,6 +152,7 @@ The code sample relies on the transient fault library to protect against transie
145
152
sqlconn.Insert(blog);
146
153
}
147
154
});
155
+
```
148
156
149
157
**SqlDatabaseUtils.SqlRetryPolicy** in the code above is defined as a **SqlDatabaseTransientErrorDetectionStrategy** with a retry count of 10, and 5 seconds wait time between retries. If you are using transactions, make sure that your retry scope goes back to the beginning of the transaction in the case of a transient fault.
The following sample code uses the familiar programming experience with .NET System.Transactions. The TransactionScope class establishes an ambient transaction in .NET. (An “ambient transaction” is one that lives in the current thread.) All connections opened within the TransactionScope participate in the transaction. If different databases participate, the transaction is automatically elevated to a distributed transaction. The outcome of the transaction is controlled by setting the scope to complete to indicate a commit.
46
46
47
+
```csharp
47
48
using (varscope=newTransactionScope())
48
49
{
49
50
using (varconn1=newSqlConnection(connStrDb1))
@@ -64,12 +65,14 @@ The following sample code uses the familiar programming experience with .NET Sys
64
65
65
66
scope.Complete();
66
67
}
68
+
```
67
69
68
70
### Sharded database applications
69
71
70
72
Elastic database transactions for SQL Database also support coordinating distributed transactions where you use the OpenConnectionForKey method of the elastic database client library to open connections for a scaled out data tier. Consider cases where you need to guarantee transactional consistency for changes across several different sharding key values. Connections to the shards hosting the different sharding key values are brokered using OpenConnectionForKey. In the general case, the connections can be to different shards such that ensuring transactional guarantees requires a distributed transaction.
71
73
The following code sample illustrates this approach. It assumes that a variable called shardmap is used to represent a shard map from the elastic database client library:
72
74
75
+
```csharp
73
76
using (varscope=newTransactionScope())
74
77
{
75
78
using (varconn1=shardmap.OpenConnectionForKey(tenantId1, credentialsStr))
@@ -90,6 +93,7 @@ The following code sample illustrates this approach. It assumes that a variable
90
93
91
94
scope.Complete();
92
95
}
96
+
```
93
97
94
98
## .NET installation for Azure Cloud Services
95
99
@@ -99,6 +103,7 @@ For Azure App Service, upgrades to the guest OS are currently not supported. For
99
103
100
104
Note that the installer for .NET 4.6.1 may require more temporary storage during the bootstrapping process on Azure cloud services than the installer for .NET 4.6. To ensure a successful installation, you need to increase temporary storage for your Azure cloud service in your ServiceDefinition.csdef file in the LocalResources section and the environment settings of your startup task, as shown in the following sample:
0 commit comments