Azure-docs: The example title says its for .NET but all the code examples are in Azure CLI

Created on 14 Feb 2019  Â·  11Comments  Â·  Source: MicrosoftDocs/azure-docs

I clicked on the link for "Set and retrieve a secret -.NET". I expected the examples to be in C#. However, all the examples are in Azure CLI. Do you have examples of how to use this in C#?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

cxp doc-enhancement key-vaulsvc triaged

All 11 comments

@clisc Thank you for your feedback . We will investigate and update the thread further.

There is a good blog post on this that you can reference.

As for Microsoft official documentation, this might be a better guide to use than the one here. https://docs.microsoft.com/en-us/azure/key-vault/tutorial-net-create-vault-azure-web-app

There is a Nuget package that allows you to connect to Azure Keyvault without specifying the Azure Active Directory Client Id.

Microsoft.Azure.Services.AppAuthentication
You also need to install the Microsoft.Azure.KeyVault nuget package.

using Microsoft.Azure.KeyVault;
using Microsoft.Azure.Services.AppAuthentication;

...

var azureServiceTokenProvider = new AzureServiceTokenProvider();
var keyVaultClient = new KeyVaultClient(
     new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
var secret = await keyVaultClient.GetSecretAsync(
    "https://{{my-vault-name}}.vault.azure.net/", "{{my-secret}}");

If you would like more documentation I would recommend leaving this request in User Voice where the product team can directly address it. https://feedback.azure.com/forums/169401-azure-active-directory

We will now proceed to close this thread. If you have further questions feel free to tag me in the comments or reach out on MSDN and I will gladly continue the discussion. https://social.msdn.microsoft.com/Forums/en-US/home?forum=WindowsAzureAD%2CAzureKeyVault&filter=alltypes&sort=lastpostdesc

It doesn't look like the issue with the documentation was fixed:

image

Can you see how I clearly clicked on "Set and retrieve a secret - .NET" but the example on the right shows "Azure CLI"? This is not correct. Azure CLI is the first item in the list of Quickstarts in the menu on the left.

How do I reopen this issue since it was not resolved?

Hi @clisc ,

The title and the document are correct and intentional. We want to demonstrate how to retrieve a secret in .NET. But before that all other commands are usually 1 time and can be done via Command Line. Is there anything specific you want to see done in .NET?

I guess I don't understand. I only see "Azure CLI" code examples in the quickstart and I don't see any .NET code at all. Where are you demonstrating how to retrieve a secret in .NET?

If you go through the entire tutorial starting this section - https://docs.microsoft.com/en-us/azure/key-vault/quick-create-net#clone-the-repo which asks you to clone a repo is written in c#. And it shows how to fetch a secret from Key Vault in C#

Thanks - I was looking for the code inline with the documentation like other examples and did not see that the example had to be downloaded.

@clisc - Glad you found it. In the other example also we ask for users to git clone the repo - https://docs.microsoft.com/en-us/azure/key-vault/quick-create-node

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ponant picture Ponant  Â·  3Comments

JeffLoo-ong picture JeffLoo-ong  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

DeepPuddles picture DeepPuddles  Â·  3Comments

ianpowell2017 picture ianpowell2017  Â·  3Comments