Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/azure/sdk/authentication/additional-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Perform the following steps to enable the application to authenticate through th

The following example demonstrates using an [`InteractiveBrowserCredential`](/dotnet/api/azure.identity.interactivebrowsercredential) to authenticate with the [`BlobServiceClient`](/dotnet/api/azure.storage.blobs.blobserviceclient):

:::code language="csharp" source="../snippets/additional-auth/interactive/InteractiveBrowserAuth.cs" highlight="15-17":::
:::code language="csharp" source="../snippets/authentication/additional-auth/interactive/InteractiveBrowserAuth.cs" highlight="15-17":::

For more exact control, such as setting redirect URIs, you can supply specific arguments to `InteractiveBrowserCredential` such as `redirect_uri`.

Expand Down Expand Up @@ -82,7 +82,7 @@ Perform the following steps to enable the application to authenticate through th

The following example demonstrates using an [`InteractiveBrowserCredential`](/dotnet/api/azure.identity.interactivebrowsercredential?view=azure-dotnet) in a Windows Forms app to authenticate with the [`BlobServiceClient`](/dotnet/api/azure.storage.blobs.blobserviceclient):

:::code language="csharp" source="../snippets/additional-auth/interactive/InteractiveBrokeredAuth.cs" highlight="16-20":::
:::code language="csharp" source="../snippets/authentication/additional-auth/interactive/InteractiveBrokeredAuth.cs" highlight="16-20":::

> [!NOTE]
> Visit the [Parent window handles](/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam#parent-window-handles) and [Retrieve a window handle](/windows/apps/develop/ui-input/retrieve-hwnd) articles for more information about retrieving window handles.
Expand All @@ -99,7 +99,7 @@ Many people always sign in to Windows with the same user account and, therefore,

The following example shows how to enable sign-in with the default system account:

:::code language="csharp" source="../snippets/additional-auth/interactive/SilentBrokeredAuth.cs" highlight="16-24":::
:::code language="csharp" source="../snippets/authentication/additional-auth/interactive/SilentBrokeredAuth.cs" highlight="16-24":::

Once you opt into this behavior, the credential attempts to sign in by asking the underlying Microsoft Authentication Library (MSAL) to perform the sign-in for the default system account. If the sign-in fails, the credential falls back to displaying the account picker dialog, from which the user can select the appropriate account.

Expand All @@ -125,4 +125,4 @@ This method authenticates an application using previously collected credentials
>
> Furthermore, this method authenticates only work and school accounts; Microsoft accounts aren't supported. For more information, see [Sign up your organization to use Microsoft Entra ID](/entra/fundamentals/sign-up-organization).

:::code language="csharp" source="../snippets/additional-auth/username-password/Program.cs" highlight="9-11":::
:::code language="csharp" source="../snippets/authentication/additional-auth/username-password/Program.cs" highlight="9-11":::

This file was deleted.

16 changes: 16 additions & 0 deletions docs/azure/sdk/snippets/authentication/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<!-- Azure SDK packages -->
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
<PackageVersion Include="Azure.Identity.Broker" Version="1.1.0" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.21.2" />
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.5" />

<!-- ASP.NET Core packages -->
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.7.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Azure.Identity.Broker" Version="1.1.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.21.2" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Identity.Broker" />
<PackageReference Include="Azure.Storage.Blobs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Azure.Identity;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;

string clientId = Environment.GetEnvironmentVariable("AZURE_CLIENT_ID")!;
string tenantId = Environment.GetEnvironmentVariable("AZURE_TENANT_ID")!;
string username = Environment.GetEnvironmentVariable("AZURE_USERNAME")!;
string password = Environment.GetEnvironmentVariable("AZURE_PASSWORD")!;

BlobServiceClient client = new(
new Uri("https://<storage-account-name>.blob.core.windows.net"),
new UsernamePasswordCredential(username, password, tenantId, clientId));

foreach (BlobContainerItem blobItem in client.GetBlobContainers())
{
Console.WriteLine(blobItem.Name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Azure.Identity.Broker" Version="1.1.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.21.2" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Storage.Blobs" />
</ItemGroup>

</Project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Storage.Blobs" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="Microsoft.Extensions.Azure" />
<PackageReference Include="Swashbuckle.AspNetCore" />
</ItemGroup>

</Project>
Loading