Skip to content

Commit 2b67c61

Browse files
authored
Merge pull request #114596 from jlichwa/patch-15
Update tutorial-net-create-vault-azure-web-app.md
2 parents a221f01 + 36232c5 commit 2b67c61

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

articles/key-vault/general/tutorial-net-create-vault-azure-web-app.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ FTP and local Git can deploy to an Azure web app by using a *deployment user*. O
101101

102102
To configure the deployment user, run the [az webapp deployment user set](/cli/azure/webapp/deployment/user?view=azure-cli-latest#az-webapp-deployment-user-set) command. Choose a username and password that adheres to these guidelines:
103103

104-
- The username must be unique within Azure, and for local Git pushes, must not contain the ‘@’ symbol.
104+
- The username must be unique within Azure, and for local Git pushes, must not contain the ‘@’ symbol.
105105
- The password must be at least eight characters long, with two of the following three elements: letters, numbers, and symbols.
106106

107107
```azurecli-interactive
@@ -280,10 +280,20 @@ using Azure.Identity;
280280
using Azure.Security.KeyVault.Secrets;
281281
```
282282

283-
Add these three lines before the `app.UseEndpoints` call, updating the URI to reflect the `vaultUri` of your key vault.
283+
Add these lines before the `app.UseEndpoints` call, updating the URI to reflect the `vaultUri` of your key vault. Below code is using ['DefaultAzureCredential()'](/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet) for authentication to key vault, which is using token from application managed identity to authenticate. It is also using exponential backoff for retries in case of key vault is being throttled.
284284

285285
```csharp
286-
var client = new SecretClient(new Uri("https://<your-unique-key-vault-name>.vault.azure.net/"), new DefaultAzureCredential());
286+
SecretClientOptions options = new SecretClientOptions()
287+
{
288+
Retry =
289+
{
290+
Delay= TimeSpan.FromSeconds(2),
291+
MaxDelay = TimeSpan.FromSeconds(16),
292+
MaxRetries = 5,
293+
Mode = RetryMode.Exponential
294+
}
295+
};
296+
var client = new SecretClient(new Uri("https://<your-unique-key-vault-name>.vault.azure.net/"), new DefaultAzureCredential(),options);
287297

288298
KeyVaultSecret secret = client.GetSecret("mySecret");
289299

0 commit comments

Comments
 (0)