Q: What is the CSharp tool used to take a DLL or EXE and show the IL, the MISL file?

A: The tool you are looking for is called "ildasm.exe". It is a command-line tool that is included with the .NET Framework SDK. It lets you view the IL (Intermediate Language) code of a compiled .NET assembly, and also allows you to examine metadata, resources, and other information about the assembly.

Here's how you can use ildasm.exe to view the IL code of a DLL or EXE file:

  1. Open a Command Prompt window.

  2. Navigate to the directory where the DLL or EXE file is located.

  3. Type "ildasm" followed by the name of the file you want to examine, like this:

    ildasm MyAssembly.dll
  4. Press Enter to run the command.

  5. The ildasm application will load the assembly and display the IL code in its main window. You can also use the various menus and buttons in the application to examine other aspects of the assembly.

Q: what's the best way to grab a keyVault secret from a function, since Microsoft.Azure.Services.AppAuthentication is depricated and is no longer available in Nuget?

A: There are multiple ways to grab a Key Vault secret from a function if you are not able to use the Microsoft.Azure.Services.AppAuthentication package:

  1. Using the Azure.Identity package: You can use the DefaultAzureCredential class from the Azure.Identity package to authenticate against Azure without storing credentials in your code. Here's an example code snippet to retrieve the Key Vault secret using Azure.Identity:

using Azure.Identity;
using Azure.Security.KeyVault.Secrets;

var client = new SecretClient(new Uri("<key-vault-uri>"), new DefaultAzureCredential());
var secret = await client.GetSecretAsync("<secret-name>");
Console.WriteLine(secret.Value);
  1. Using the Microsoft.Azure.KeyVault NuGet package: You can use the KeyVaultClient class from the Microsoft.Azure.KeyVault NuGet package to retrieve the Key Vault secret. You will need to provide your Azure AD app's client ID and client secret or a certificate. Here's an example code snippet to retrieve the Key Vault secret using Microsoft.Azure.KeyVault:

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("<key-vault-uri>", "<secret-name>");
Console.WriteLine(secret.Value);

Note: Azure.Identity has replaced Microsoft.Azure.Services.AppAuthentication package and it is recommended to use the latest package. The example shown above using Azure.Identity package will only work with .NET Core 2.1 and above.

Last updated