Skip to content

Commit fd59e86

Browse files
authored
Merge pull request #110443 from MicrosoftDocs/repo_sync_working_branch
Confirm merge from repo_sync_working_branch to master to sync with https://github.com/Microsoft/azure-docs (branch master)
2 parents 941b8d7 + 03e0eaa commit fd59e86

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

articles/app-service/configure-ssl-certificate-in-code.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,32 @@ In C# code, you access the certificate by the certificate thumbprint. The follow
5454

5555
```csharp
5656
using System;
57+
using System.Linq;
5758
using System.Security.Cryptography.X509Certificates;
5859

59-
...
60-
X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
61-
certStore.Open(OpenFlags.ReadOnly);
62-
X509Certificate2Collection certCollection = certStore.Certificates.Find(
63-
X509FindType.FindByThumbprint,
64-
// Replace below with your certificate's thumbprint
65-
"E661583E8FABEF4C0BEF694CBC41C28FB81CD870",
66-
false);
67-
// Get the first cert with the thumbprint
68-
if (certCollection.Count > 0)
60+
string certThumbprint = "E661583E8FABEF4C0BEF694CBC41C28FB81CD870";
61+
bool validOnly = false;
62+
63+
using (X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser))
6964
{
70-
X509Certificate2 cert = certCollection[0];
71-
// Use certificate
72-
Console.WriteLine(cert.FriendlyName);
65+
certStore.Open(OpenFlags.ReadOnly);
66+
67+
X509Certificate2Collection certCollection = certStore.Certificates.Find(
68+
X509FindType.FindByThumbprint,
69+
// Replace below with your certificate's thumbprint
70+
certThumbprint,
71+
validOnly);
72+
// Get the first cert with the thumbprint
73+
X509Certificate2 cert = certCollection.OfType<X509Certificate>().FirstOrDefault();
74+
75+
if (cert is null)
76+
throw new Exception($"Certificate with thumbprint {certThumbprint} was not found");
77+
78+
// Use certificate
79+
Console.WriteLine(cert.FriendlyName);
80+
81+
// Consider to call Dispose() on the certificate after it's being used, avaliable in .NET 4.6 and later
7382
}
74-
certStore.Close();
75-
...
7683
```
7784

7885
In Java code, you access the certificate from the "Windows-MY" store using the Subject Common Name field (see [Public key certificate](https://en.wikipedia.org/wiki/Public_key_certificate)). The following code shows how to load a private key certificate:
@@ -107,10 +114,11 @@ The certificate file names are the certificate thumbprints. The following C# cod
107114

108115
```csharp
109116
using System;
117+
using System.IO;
110118
using System.Security.Cryptography.X509Certificates;
111119

112120
...
113-
var bytes = System.IO.File.ReadAllBytes("/var/ssl/certs/<thumbprint>.der");
121+
var bytes = File.ReadAllBytes("/var/ssl/certs/<thumbprint>.der");
114122
var cert = new X509Certificate2(bytes);
115123

116124
// Use the loaded certificate
@@ -135,10 +143,11 @@ The following C# example loads a public certificate from a relative path in your
135143
136144
```csharp
137145
using System;
146+
using System.IO;
138147
using System.Security.Cryptography.X509Certificates;
139148
140149
...
141-
var bytes = System.IO.File.ReadAllBytes("~/<relative-path-to-cert-file>");
150+
var bytes = File.ReadAllBytes("~/<relative-path-to-cert-file>");
142151
var cert = new X509Certificate2(bytes);
143152
144153
// Use the loaded certificate

articles/key-vault/quick-create-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ az keyvault create --name <your-unique-keyvault-name> -g "myResourceGroup"
6363

6464
### Create a service principal
6565

66-
The simplest way to authenticate a cloud-based .NET application is with a managed identity; see [Use an App Service managed identity to access Azure Key Vault](managed-identity.md) for details. For the sake of simplicity however, this quickstart creates a .NET console application. Authenticating a desktop application with Azure requires the use of a service principal and an access control policy.
66+
The simplest way to authenticate a cloud-based Python application is with a managed identity; see [Use an App Service managed identity to access Azure Key Vault](managed-identity.md) for details. For the sake of simplicity however, this quickstart creates a Python console application. Authenticating a desktop application with Azure requires the use of a service principal and an access control policy.
6767

6868
Create a service principle using the Azure CLI [az ad sp create-for-rbac](/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-create-for-rbac) command:
6969

includes/disk-encryption-key-vault.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ New-AzResourceGroup -Name "myResourceGroup" -Location "EastUS"
3434
Create a key vault using the [az keyvault create](/cli/azure/keyvault?view=azure-cli-latest#az-keyvault-create) Azure CLI command, the [New-AzKeyvault](/powershell/module/az.keyvault/new-azkeyvault) Azure Powershell command, the [Azure portal](https://portal.azure.com), or a [Resource Manager template](https://github.com/Azure/azure-quickstart-templates/tree/master/101-key-vault-create).
3535

3636
>[!WARNING]
37-
> To ensure that encryption secrets don't cross regional boundaries, Azure Disk Encryption requires the Key Vault and the VMs to be co-located in the same region. Create and use a Key Vault that is in the same region as the VMs to be encrypted.
37+
> To ensure that encryption secrets don't cross regional boundaries, Azure Disk Encryption requires the Key Vault and the VMs to be co-located in the same region and same subscription. Create and use a Key Vault that is in the same region as the VMs to be encrypted.
3838
3939
Each Key Vault must have a unique name. Replace <your-unique-keyvault-name> with the name of your key vault in the following examples.
4040

0 commit comments

Comments
 (0)