Skip to content

Commit 4eee3b5

Browse files
authored
Merge pull request #3997 from ryanvog/preview
Update DevTest Lab cmdlets and tests to match current SDK
2 parents 47eb780 + 363e102 commit 4eee3b5

25 files changed

+413
-459
lines changed

setup/azurecmdfiles.wxi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,9 +1142,6 @@
11421142
<Component Id="cmp18559E426D9575F9741C6BB896E36096" Guid="*">
11431143
<File Id="fil3FDE0768954463E11C3F755477EA3F82" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DevTestLabs\Microsoft.Azure.Graph.RBAC.dll" />
11441144
</Component>
1145-
<Component Id="cmp06CD6BDE473F792012CE7024813F220A" Guid="*">
1146-
<File Id="fil34B0A4BF46121307742C9608A85B8003" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DevTestLabs\Microsoft.Azure.Management.Authorization.dll" />
1147-
</Component>
11481145
<Component Id="cmp95F2278E8024575B268B5ADB26BF55E3" Guid="*">
11491146
<File Id="filE5725D3B7BFD6FFF3EF8DCC5B4A91494" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DevTestLabs\Microsoft.Azure.Management.DevTestLabs.dll" />
11501147
</Component>
@@ -5698,7 +5695,6 @@
56985695
<ComponentRef Id="cmp3F1C1F7F308468B14973DE21B2862307" />
56995696
<ComponentRef Id="cmpE037063BF3683AE4D6206BBB51BC3393" />
57005697
<ComponentRef Id="cmp18559E426D9575F9741C6BB896E36096" />
5701-
<ComponentRef Id="cmp06CD6BDE473F792012CE7024813F220A" />
57025698
<ComponentRef Id="cmp95F2278E8024575B268B5ADB26BF55E3" />
57035699
<ComponentRef Id="cmp01C0D7F5A138E257E63C9A88A6E77FB5" />
57045700
<ComponentRef Id="cmp6A0A2D259AAD3356C7AFB688CDA4A47C" />

src/ResourceManager/DevTestLabs/ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21-
21+
* Update cmdlets to work with current and updated DevTest Lasbs API version.
2222
## Version 3.0.0
2323

2424
## Version 2.8.0

src/ResourceManager/DevTestLabs/Commands.DevTestLabs.Test/Commands.DevTestLabs.Test.csproj

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,11 @@
5555
<SpecificVersion>False</SpecificVersion>
5656
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
5757
</Reference>
58-
<Reference Include="Microsoft.Azure.Management.Authorization, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59-
<SpecificVersion>False</SpecificVersion>
60-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
61-
<Private>True</Private>
58+
<Reference Include="Microsoft.Azure.Management.DevTestLabs, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DevTestLabs.2.0.1\lib\net452\Microsoft.Azure.Management.DevTestLabs.dll</HintPath>
6260
</Reference>
63-
<Reference Include="Microsoft.Azure.Management.DevTestLabs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
64-
<SpecificVersion>False</SpecificVersion>
65-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DevTestLabs.1.0.1-preview\lib\net45\Microsoft.Azure.Management.DevTestLabs.dll</HintPath>
66-
<Private>True</Private>
61+
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
6763
</Reference>
6864
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6965
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.3.0.0\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
@@ -79,8 +75,7 @@
7975
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.6179.26854-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
8076
</Reference>
8177
<Reference Include="Microsoft.Azure.Test.HttpRecorder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
82-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.7-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
83-
<Private>True</Private>
78+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.8.1\lib\net452\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
8479
</Reference>
8580
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.28.3.860, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8681
<SpecificVersion>False</SpecificVersion>
@@ -91,16 +86,16 @@
9186
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
9287
</Reference>
9388
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
94-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
95-
<Private>True</Private>
89+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
9690
</Reference>
9791
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
98-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
99-
<Private>True</Private>
92+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.7\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
10093
</Reference>
101-
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework">
102-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
103-
<Private>True</Private>
94+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
95+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.3.1\lib\net452\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
96+
</Reference>
97+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
98+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.7.1\lib\net452\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
10499
</Reference>
105100
<Reference Include="Moq">
106101
<HintPath>..\..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>

src/ResourceManager/DevTestLabs/Commands.DevTestLabs.Test/ScenarioTests/Common.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function Setup-Test-ResourceGroup
6969
New-AzureRmResourceGroup -Name $rgname -Location $location
7070
New-AzureRmResourceGroupDeployment -Name $labName -ResourceGroupName $rgname `
7171
-TemplateParameterObject @{ newLabName = "$labName" } `
72-
-TemplateFile https://raw.githubusercontent.com/Azure/azure-devtestlab/master/ARMTemplates/101-dtl-create-lab/azuredeploy.json
72+
-TemplateFile https://raw.githubusercontent.com/Azure/azure-devtestlab/master/Samples/101-dtl-create-lab/azuredeploy.json
7373
}
7474

7575
<#

src/ResourceManager/DevTestLabs/Commands.DevTestLabs.Test/ScenarioTests/DevTestLabsController.cs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414

1515
using Microsoft.Azure.Commands.Common.Authentication;
1616
using Microsoft.Azure.Gallery;
17-
using Microsoft.Azure.Management.Authorization;
1817
using Microsoft.Azure.Management.DevTestLabs;
19-
using Microsoft.Azure.Management.Resources;
18+
using Microsoft.Azure.Management.ResourceManager;
2019
using Microsoft.Azure.Management.Storage;
21-
using Microsoft.Azure.Subscriptions;
2220
using Microsoft.Azure.Test.HttpRecorder;
2321
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
2422
using Microsoft.WindowsAzure.Commands.ScenarioTest;
@@ -38,15 +36,13 @@ public class DevTestLabsController
3836
private EnvironmentSetupHelper helper;
3937
private const string TenantIdKey = "TenantId";
4038
private const string DomainKey = "Domain";
41-
private const string AuthorizationApiVersion = "2014-07-01-preview";
4239

4340
public ResourceManagementClient ResourceManagementClient { get; private set; }
4441

4542
public SubscriptionClient SubscriptionClient { get; private set; }
4643

4744
public DevTestLabsClient DevTestLabsClient { get; private set; }
4845

49-
public AuthorizationManagementClient AuthorizationManagementClient { get; private set; }
5046

5147
public GalleryClient GalleryClient { get; private set; }
5248

@@ -100,7 +96,7 @@ public void RunPsTestWorkflow(
10096
d.Add("Microsoft.Features", null);
10197
d.Add("Microsoft.Authorization", null);
10298
var providersToIgnore = new Dictionary<string, string>();
103-
providersToIgnore.Add("Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01");
99+
providersToIgnore.Add("Microsoft.Azure.Management.ResourceManager.ResourceManagementClient", "2016-02-01");
104100
HttpMockServer.Matcher = new PermissiveRecordMatcherWithApiExclusion(true, d, providersToIgnore);
105101

106102
HttpMockServer.RecordsDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SessionRecords");
@@ -121,7 +117,6 @@ public void RunPsTestWorkflow(
121117
"ScenarioTests\\Common.ps1",
122118
"ScenarioTests\\" + callingClassName + ".ps1",
123119
helper.RMProfileModule,
124-
helper.RMStorageDataPlaneModule,
125120
helper.RMResourceModule,
126121
helper.GetRMModulePath(@"AzureRM.DevTestLabs.psd1"));
127122

@@ -149,17 +144,15 @@ public void RunPsTestWorkflow(
149144

150145
private void SetupManagementClients(MockContext context)
151146
{
152-
ResourceManagementClient = GetResourceManagementClient();
153-
SubscriptionClient = GetSubscriptionClient();
147+
ResourceManagementClient = GetResourceManagementClient(context);
148+
SubscriptionClient = GetSubscriptionClient(context);
154149
DevTestLabsClient = GetDevTestLabsManagementClient(context);
155-
AuthorizationManagementClient = GetAuthorizationManagementClient();
156150
GalleryClient = GetGalleryClient();
157151

158152
var armStorageManagementClient = GetArmStorageManagementClient();
159153
helper.SetupManagementClients(ResourceManagementClient,
160154
SubscriptionClient,
161155
DevTestLabsClient,
162-
AuthorizationManagementClient,
163156
GalleryClient,
164157
armStorageManagementClient
165158
);
@@ -170,24 +163,20 @@ protected StorageManagementClient GetArmStorageManagementClient()
170163
return LegacyTest.TestBase.GetServiceClient<StorageManagementClient>(this.csmTestFactory);
171164
}
172165

173-
private AuthorizationManagementClient GetAuthorizationManagementClient()
174-
{
175-
return LegacyTest.TestBase.GetServiceClient<AuthorizationManagementClient>(this.csmTestFactory);
176-
}
177166

178-
private ResourceManagementClient GetResourceManagementClient()
167+
private ResourceManagementClient GetResourceManagementClient(MockContext context)
179168
{
180-
return LegacyTest.TestBase.GetServiceClient<ResourceManagementClient>(this.csmTestFactory);
169+
return context.GetServiceClient<ResourceManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
181170
}
182171

183172
private DevTestLabsClient GetDevTestLabsManagementClient(MockContext context)
184173
{
185174
return context.GetServiceClient<DevTestLabsClient>(TestEnvironmentFactory.GetTestEnvironment());
186175
}
187176

188-
private SubscriptionClient GetSubscriptionClient()
177+
private SubscriptionClient GetSubscriptionClient(MockContext context)
189178
{
190-
return LegacyTest.TestBase.GetServiceClient<SubscriptionClient>(this.csmTestFactory);
179+
return context.GetServiceClient<SubscriptionClient>(TestEnvironmentFactory.GetTestEnvironment());
191180
}
192181

193182
private GalleryClient GetGalleryClient()

0 commit comments

Comments
 (0)