Skip to content

Commit 466bceb

Browse files
authored
Update mi test mi for region lock sfi (#5538)
* Update managed identity references to new MI - Replace old MI client ID (3b57c42c-3201-4295-ae27-d6baec5b7027) with new MI (45344e7d-c562-4be6-868f-18dac789c021) - Replace old MI object ID (9fc6a41b-e161-43ba-90ba-12f172141c23) with new MI (a38637b6-b365-4652-af1f-cf5d8cf829ad) - Update resource ID from MSAL_MSI_USERID to Msal_Integration_tests - Update location from East US 2 to East US - Update readme.md documentation with new MI details and Azure portal links - All tests passing with new managed identity configuration * Consolidate Key Vault UAMI into main UAMI - Remove separate LabVaultAccessUserAssignedClientID (4b7a4b0b-ecb2-409e-879a-1e21a15ddaf6) - Update AcquireMsiToken_ExchangeForEstsToken_Successfully test to use consolidated UAMI - Use single UserAssignedClientID (45344e7d-c562-4be6-868f-18dac789c021) for both MSI and Key Vault access - Add documentation comments explaining the consolidation Note: Token exchange test requires federated identity credential in RequestMSIDLAB app registration * Fix E2E IMDS tests to use ID4SMSIHostedAgent pool's managed identity - Update ManagedIdentityImdsTests.cs to use ID4SMSIHostedAgent_UAMI - Client ID: 8ef2ae5a-f349-4d36-bc0e-a567f2cc50f7 - Object ID: 0651a6fc-fbf5-4904-9e48-16f63ec1f2b1 - Resource ID: /subscriptions/6f52c299-a200-4fe1-8822-a3b61cf1f931/resourcegroups/DevOpsHostedAgents/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID4SMSIHostedAgent_UAMI - Fixes pool access issues where E2E tests couldn't access the consolidated MI * Update resource IDs to use original branch values - Changed resource ID from main branch back to original branch values - Updated subscription ID: c1686c51-b717-4fe0-9af3-24a20a41fb0c -> 6f52c299-a200-4fe1-8822-a3b61cf1f931 - Updated resource group: MSAL_MSI -> DevOpsHostedAgents - Updated identity name: LabVaultAccess_UAMI -> ID4SMSIHostedAgent_UAMI - Ensures both client ID and resource ID fixes from original branch are preserved * Fix Object ID for new managed identity - Updated Object ID from 1eee55b7-168a-46be-8d19-30e830ee9611 to 0651a6fc-fbf5-4904-9e48-16f63ec1f2b1 - Now all three test variants (ClientId, ResourceId, ObjectId) reference the same ID4SMSIHostedAgent_UAMI managed identity - Object ID matches the Principal ID of the created managed identity
1 parent 079b176 commit 466bceb

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

tests/Microsoft.Identity.Test.E2e/ManagedIdentityImdsTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ private static IManagedIdentityApplication BuildMi(
3939
[TestCategory("MI_E2E_Imds")]
4040
[DataTestMethod]
4141
[DataRow(null /*SAMI*/, null, DisplayName = "AcquireToken_OnImds_Succeeds-SAMI")]
42-
[DataRow("4b7a4b0b-ecb2-409e-879a-1e21a15ddaf6", "clientid", DisplayName = "AcquireToken_OnImds_Succeeds-UAMI-ClientId")]
43-
[DataRow("/subscriptions/c1686c51-b717-4fe0-9af3-24a20a41fb0c/resourcegroups/MSAL_MSI/providers/Microsoft.ManagedIdentity/userAssignedIdentities/LabVaultAccess_UAMI",
42+
[DataRow("8ef2ae5a-f349-4d36-bc0e-a567f2cc50f7", "clientid", DisplayName = "AcquireToken_OnImds_Succeeds-UAMI-ClientId")]
43+
[DataRow("/subscriptions/6f52c299-a200-4fe1-8822-a3b61cf1f931/resourcegroups/DevOpsHostedAgents/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID4SMSIHostedAgent_UAMI",
4444
"resourceid", DisplayName = "AcquireToken_OnImds_Succeeds-UAMI-ResourceId")]
45-
[DataRow("1eee55b7-168a-46be-8d19-30e830ee9611", "objectid", DisplayName = "AcquireToken_OnImds_Succeeds-UAMI-ObjectId")]
45+
[DataRow("0651a6fc-fbf5-4904-9e48-16f63ec1f2b1", "objectid", DisplayName = "AcquireToken_OnImds_Succeeds-UAMI-ObjectId")]
4646
public async Task AcquireToken_OnImds_Succeeds(string id, string idType)
4747
{
4848
var mi = BuildMi(id, idType);
@@ -69,10 +69,10 @@ public async Task AcquireToken_OnImds_Succeeds(string id, string idType)
6969
[TestCategory("MI_E2E_Imds")]
7070
[DataTestMethod]
7171
[DataRow(null /*SAMI*/, null, DisplayName = "AcquireToken_OnImds_Fails_WithMtlsProofOfPossession-SAMI")]
72-
[DataRow("4b7a4b0b-ecb2-409e-879a-1e21a15ddaf6", "clientid", DisplayName = "AcquireToken_OnImds_Fails_WithMtlsProofOfPossession-UAMI-ClientId")]
73-
[DataRow("/subscriptions/c1686c51-b717-4fe0-9af3-24a20a41fb0c/resourcegroups/MSAL_MSI/providers/Microsoft.ManagedIdentity/userAssignedIdentities/LabVaultAccess_UAMI",
72+
[DataRow("8ef2ae5a-f349-4d36-bc0e-a567f2cc50f7", "clientid", DisplayName = "AcquireToken_OnImds_Fails_WithMtlsProofOfPossession-UAMI-ClientId")]
73+
[DataRow("/subscriptions/6f52c299-a200-4fe1-8822-a3b61cf1f931/resourcegroups/DevOpsHostedAgents/providers/Microsoft.ManagedIdentity/userAssignedIdentities/ID4SMSIHostedAgent_UAMI",
7474
"resourceid", DisplayName = "AcquireToken_OnImds_Fails_WithMtlsProofOfPossession-UAMI-ResourceId")]
75-
[DataRow("1eee55b7-168a-46be-8d19-30e830ee9611", "objectid", DisplayName = "AcquireToken_OnImds_Fails_WithMtlsProofOfPossession-UAMI-ObjectId")]
75+
[DataRow("0651a6fc-fbf5-4904-9e48-16f63ec1f2b1", "objectid", DisplayName = "AcquireToken_OnImds_Fails_WithMtlsProofOfPossession-UAMI-ObjectId")]
7676
public async Task AcquireToken_OnImds_Fails_WithMtlsProofOfPossession(string id, string idType)
7777
{
7878
var mi = BuildMi(id, idType);

tests/Microsoft.Identity.Test.Integration.netcore/HeadlessTests/ManagedIdentityTests.NetFwk.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@ public class ManagedIdentityTests
3636
//http proxy base URL
3737
private static readonly string s_baseURL = "https://service.msidlab.com/";
3838

39-
//Shared User Assigned Client ID
40-
private const string UserAssignedClientID = "3b57c42c-3201-4295-ae27-d6baec5b7027";
39+
//Shared User Assigned Client ID - Consolidated UAMI for both MSI endpoints and Key Vault access
40+
private const string UserAssignedClientID = "45344e7d-c562-4be6-868f-18dac789c021";
4141

42+
//Lab Access Client ID for certificate-based authentication to lab resources
4243
private const string LabAccessClientID = "f62c5ae3-bf3a-4af5-afa8-a68b800396e9";
4344

44-
private const string LabVaultAccessUserAssignedClientID = "4b7a4b0b-ecb2-409e-879a-1e21a15ddaf6";
45-
46-
private const string UserAssignedObjectID = "9fc6a41b-e161-43ba-90ba-12f172141c23";
45+
private const string UserAssignedObjectID = "a38637b6-b365-4652-af1f-cf5d8cf829ad";
4746

4847
//Non Existent User Assigned Client/Object ID
4948
private const string SomeRandomGuid = "f07359bb-f4f6-4e3c-ba9f-ccdf48eb80ce";
@@ -55,7 +54,7 @@ public class ManagedIdentityTests
5554
//Resource ID of the User Assigned Identity
5655
private const string UamiResourceId = "/subscriptions/c1686c51-b717-4fe0-9af3-24a20a41fb0c/" +
5756
"resourcegroups/MSAL_MSI/providers/Microsoft.ManagedIdentity/userAssignedIdentities/" +
58-
"MSAL_MSI_USERID";
57+
"Msal_Integration_tests";
5958

6059
//non existent Resource ID of the User Assigned Identity
6160
private const string Non_Existent_UamiResourceId = "/subscriptions/userAssignedIdentities/NO_ID";
@@ -191,8 +190,8 @@ public async Task AcquireMsiToken_ExchangeForEstsToken_Successfully()
191190
string uri = s_baseURL + $"MSIToken?" +
192191
$"azureresource={MsiAzureResource.WebApp}&uri=";
193192

194-
//Create CCA with Proxy
195-
IManagedIdentityApplication mia = CreateMIAWithProxy(uri, LabVaultAccessUserAssignedClientID, UserAssignedIdentityId.ClientId);
193+
//Create CCA with Proxy - using the consolidated UAMI for both MSI and Key Vault access
194+
IManagedIdentityApplication mia = CreateMIAWithProxy(uri, UserAssignedClientID, UserAssignedIdentityId.ClientId);
196195

197196
AuthenticationResult result;
198197
//Act

tests/devapps/Managed Identity apps/MSIHelperService/readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Build the current project (The MSI Helper Service - MSIHelperService.csproj) and
186186
187187
## User Assigned Identity
188188

189-
This helper service also exposes the [User Identity](https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/c1686c51-b717-4fe0-9af3-24a20a41fb0c/resourceGroups/MSAL_MSI/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MSAL_MSI_USERID/overview) for testing.
189+
This helper service also exposes the [User Identity](https://ms.portal.azure.com/#@microsoft.onmicrosoft.com/resource/subscriptions/c1686c51-b717-4fe0-9af3-24a20a41fb0c/resourceGroups/MSAL_MSI/providers/Microsoft.ManagedIdentity/userAssignedIdentities/Msal_Integration_tests/overview) for testing.
190190

191191
<br>
192192
<img src="images/uid.PNG" alt="uid" width="800"/>
@@ -197,13 +197,13 @@ Following are some useful information to test the User Identity.
197197

198198
| Syntax | Description |
199199
| ----------- | ----------- |
200-
| Resource ID | /subscriptions/c1686c51-b717-4fe0-9af3-24a20a41fb0c/resourcegroups/MSAL_MSI/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MSAL_MSI_USERID |
201-
| Name | MSAL_MSI_USERID |
200+
| Resource ID | /subscriptions/c1686c51-b717-4fe0-9af3-24a20a41fb0c/resourcegroups/MSAL_MSI/providers/Microsoft.ManagedIdentity/userAssignedIdentities/Msal_Integration_tests |
201+
| Name | Msal_Integration_tests |
202202
| Type | Microsoft.ManagedIdentity/userAssignedIdentities |
203-
| Location | eastus2 |
203+
| Location | eastus |
204204
| Tenant Id | 72f988bf-86f1-41af-91ab-2d7cd011db47 |
205-
| Principal Id | 3b57c42c-3201-4295-ae27-d6baec5b7027 |
206-
| Client Id | 3b57c42c-3201-4295-ae27-d6baec5b7027 |
205+
| Principal Id | a38637b6-b365-4652-af1f-cf5d8cf829ad |
206+
| Client Id | 45344e7d-c562-4be6-868f-18dac789c021 |
207207

208208
# Troubleshooting the test service
209209

0 commit comments

Comments
 (0)