forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
VM managed identity integration test (Azure#38457)
- Loading branch information
1 parent
bcdf23f
commit e2a37c2
Showing
5 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
sdk/identity/Azure.Identity/tests/ManagedIdentityVMIntegrationTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using Azure.Core.Pipeline; | ||
using Azure.Core.TestFramework; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.Identity.Tests | ||
{ | ||
public class ManagedIdentityVMIntegrationTests : IdentityRecordedTestBase | ||
{ | ||
public ManagedIdentityVMIntegrationTests(bool isAsync) : base(isAsync) | ||
{ } | ||
|
||
[Test] | ||
[LiveOnly] | ||
[Category("IdentityVM")] | ||
// This test leverages the test app found in Azure.Identity\integration\WebApp | ||
// It validates that ManagedIdentityCredential can acquire a token in an actual Azure Web App environment | ||
public async Task GetManagedIdentityToken() | ||
{ | ||
var cred = new ManagedIdentityCredential(TestEnvironment.VMUserAssignedManagedIdentityClientId); | ||
var token = await cred.GetTokenAsync(new(CredentialTestHelpers.DefaultScope)); | ||
Assert.NotNull(token.Token); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters