Skip to content

Commit b23decf

Browse files
author
j82w
committed
Set the graph endpoint in the test framework to fix the TestServerActiveDirectoryAdministratorCRUD.
1 parent 53ff083 commit b23decf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ public void SetupEnvironment()
8989
ProfileClient.Profile.Accounts[testAccount.Id] = testAccount;
9090
ProfileClient.SetSubscriptionAsDefault(testSubscription.Name, testSubscription.Account);
9191

92+
var environment = ProfileClient.Profile.Environments[ProfileClient.Profile.DefaultSubscription.Environment];
93+
environment.Endpoints[AzureEnvironment.Endpoint.Graph] = csmEnvironment.Endpoints.GraphUri.AbsoluteUri;
94+
9295
ProfileClient.Profile.Save();
9396
}
9497
}

src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ public MicrosoftAzureCommandsResourcesModelsActiveDirectory.ActiveDirectoryClien
6565
{
6666
if (_activeDirectoryClient == null)
6767
{
68+
if (!Profile.Context.Environment.IsEndpointSet(AzureEnvironment.Endpoint.Graph))
69+
{
70+
throw new ArgumentException(string.Format(Resources.InvalidGraphEndpoint));
71+
}
6872
_activeDirectoryClient = new MicrosoftAzureCommandsResourcesModelsActiveDirectory.ActiveDirectoryClient(Profile.Context);
6973
}
7074
return this._activeDirectoryClient;

0 commit comments

Comments
 (0)