Skip to content

Commit 29ee9ac

Browse files
committed
Merge branch 'preview' of github.com:jeffrey-ACE/azure-powershell into acemod
2 parents d29ce74 + 7722405 commit 29ee9ac

27 files changed

+2012
-11
lines changed

src/ResourceManager/Resources/AzureRM.Resources.psd1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ CmdletsToExport = 'Get-AzureRmProviderOperation', 'Remove-AzureRmRoleAssignment'
120120
'Set-AzureRmManagedApplicationDefinition',
121121
'Remove-AzureRmManagedApplicationDefinition',
122122
'Get-AzureRmManagedApplication', 'New-AzureRmManagedApplication',
123-
'Set-AzureRmManagedApplication', 'Remove-AzureRmManagedApplication'
123+
'Set-AzureRmManagedApplication', 'Remove-AzureRmManagedApplication',
124+
'Get-AzureRmManagementPartner', 'New-AzureRmManagementPartner',
125+
'Update-AzureRmManagementPartner', 'Remove-AzureRmManagementPartner'
124126

125127
# Variables to export from this module
126128
# VariablesToExport = @()

src/ResourceManager/Resources/ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
* Get-AzureRmADServicePrincipal: Removed -ServicePrincipalName from the default Empty parameter set as it was redundant with the SPN parameter set
2222
* Register-AzureRmProviderFeature: Added missing example in the docs
2323
* Register-AzureRmResourceProvider: Added missing example in the docs
24+
* Add ManagementPartner cmdlets
25+
- New-AzureRmManagementPartner cmdlet to create a management partner
26+
- Get-AzureRmManagementPartner cmdlet to list the management partner for the current user
27+
- Remove-AzureRmManagementPartner cmdlet to delete a management partner
28+
- Update-AzureRmManagementPartner cmdlet to update an existing management partner
2429

2530
## Version 5.2.0
2631
* Added Location Completer to -Location parameters allowing tab completion through valid Locations

src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
<Reference Include="Microsoft.Azure.KeyVault.Core">
7171
<HintPath>..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
7272
</Reference>
73+
<Reference Include="Microsoft.Azure.Management.ManagementPartner, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
74+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ManagementPartner.1.0.0-preview\lib\net452\Microsoft.Azure.Management.ManagementPartner.dll</HintPath>
75+
<Private>True</Private>
76+
</Reference>
7377
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7478
<SpecificVersion>False</SpecificVersion>
7579
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
@@ -106,10 +110,12 @@
106110
<Private>True</Private>
107111
</Reference>
108112
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
109-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
113+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.10\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
114+
<Private>True</Private>
110115
</Reference>
111116
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
112-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
117+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.10\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
118+
<Private>True</Private>
113119
</Reference>
114120
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
115121
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.2.9-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
@@ -213,6 +219,7 @@
213219
</Content>
214220
<Compile Include="ScenarioTests\LocationTests.cs" />
215221
<Compile Include="ScenarioTests\ManagedApplicationTests.cs" />
222+
<Compile Include="ScenarioTests\ManagementPartnerTests.cs" />
216223
<Compile Include="ScenarioTests\MoveResourceTest.cs" />
217224
<Compile Include="ScenarioTests\ManagedApplicationDefinitionTests.cs" />
218225
<Compile Include="ScenarioTests\ProviderFeatureTests.cs" />
@@ -363,6 +370,9 @@
363370
<None Include="ScenarioTests\ManagedApplicationTests.ps1">
364371
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
365372
</None>
373+
<None Include="ScenarioTests\ManagementPartnerTests.ps1">
374+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
375+
</None>
366376
<None Include="ScenarioTests\MoveResourceTest.ps1">
367377
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
368378
</None>
@@ -441,6 +451,21 @@
441451
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ManagedApplicationTests\TestManagedApplicationCRUD.json">
442452
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
443453
</None>
454+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ManagementPartnerTests\TestGetPartner.json">
455+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
456+
</None>
457+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ManagementPartnerTests\TestGetPartnerNoParnterId.json">
458+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
459+
</None>
460+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ManagementPartnerTests\TestNewParnter.json">
461+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
462+
</None>
463+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ManagementPartnerTests\TestRemoveParnter.json">
464+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
465+
</None>
466+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ManagementPartnerTests\TestUpdateParnter.json">
467+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
468+
</None>
444469
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.MoveResourceTest\TestMoveAzureResource.json">
445470
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
446471
</None>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.ServiceManagemenet.Common.Models;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
18+
using Xunit;
19+
using Xunit.Abstractions;
20+
21+
namespace Microsoft.Azure.Commands.Resources.Test.ScenarioTests
22+
{
23+
public class ManagementPartnerTests : RMTestBase
24+
{
25+
public ManagementPartnerTests(ITestOutputHelper output)
26+
{
27+
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
28+
}
29+
30+
[Fact]
31+
[Trait(Category.AcceptanceType, Category.CheckIn)]
32+
public void TestGetPartner()
33+
{
34+
ResourcesController.NewInstance.RunPsTest( "Test-GetPartner");
35+
}
36+
37+
[Fact]
38+
[Trait(Category.AcceptanceType, Category.CheckIn)]
39+
public void TestGetPartnerNoParnterId()
40+
{
41+
ResourcesController.NewInstance.RunPsTest("Test-GetPartnerNoPartnerId");
42+
}
43+
44+
[Fact]
45+
[Trait(Category.AcceptanceType, Category.CheckIn)]
46+
public void TestNewParnter()
47+
{
48+
ResourcesController.NewInstance.RunPsTest("Test-NewPartner");
49+
}
50+
51+
[Fact]
52+
[Trait(Category.AcceptanceType, Category.CheckIn)]
53+
public void TestUpdateParnter()
54+
{
55+
ResourcesController.NewInstance.RunPsTest("Test-UpdatePartner");
56+
}
57+
58+
[Fact]
59+
[Trait(Category.AcceptanceType, Category.CheckIn)]
60+
public void TestRemoveParnter()
61+
{
62+
ResourcesController.NewInstance.RunPsTest("Test-RemovePartner");
63+
}
64+
}
65+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
16+
17+
<#
18+
.SYNOPSIS
19+
Tests get management partner
20+
#>
21+
function Test-GetPartner
22+
{
23+
# Setup
24+
$partnerId="123457"
25+
$partner = New-AzureRmManagementPartner -PartnerId $partnerId
26+
27+
# Test
28+
$partner = Get-AzureRmManagementPartner -PartnerId $partnerId
29+
30+
# Assert
31+
Assert-AreEqual $partnerId $partner.PartnerId
32+
Assert-NotNull $partner.TenantId
33+
Assert-NotNull $partner.ObjectId
34+
Assert-NotNull $partner.State
35+
36+
# cleanup
37+
Remove-AzureRmManagementPartner -PartnerId $partnerId
38+
}
39+
40+
41+
<#
42+
.SYNOPSIS
43+
Tests get management partner without parnter id
44+
#>
45+
function Test-GetPartnerNoPartnerId
46+
{
47+
# Setup
48+
$partnerId="123457"
49+
$partner = New-AzureRmManagementPartner -PartnerId $partnerId
50+
51+
# Test
52+
$partner = Get-AzureRmManagementPartner
53+
54+
# Assert
55+
Assert-AreEqual $partnerId $partner.PartnerId
56+
Assert-NotNull $partner.TenantId
57+
Assert-NotNull $partner.ObjectId
58+
Assert-NotNull $partner.State
59+
60+
# cleanup
61+
Remove-AzureRmManagementPartner -PartnerId $partnerId
62+
}
63+
64+
65+
<#
66+
.SYNOPSIS
67+
Tests add management partner
68+
#>
69+
function Test-NewPartner
70+
{
71+
$partnerId="123457"
72+
$partner = New-AzureRmManagementPartner -PartnerId $partnerId
73+
74+
# Assert
75+
Assert-AreEqual $partnerId $partner.PartnerId
76+
Assert-NotNull $partner.TenantId
77+
Assert-NotNull $partner.ObjectId
78+
Assert-NotNull $partner.State
79+
80+
# cleanup
81+
Remove-AzureRmManagementPartner -PartnerId $partnerId
82+
}
83+
84+
85+
<#
86+
.SYNOPSIS
87+
Tests update management partner
88+
#>
89+
function Test-UpdatePartner
90+
{
91+
# Setup
92+
$partnerId="123457"
93+
$partner = New-AzureRmManagementPartner -PartnerId $partnerId
94+
95+
# Test
96+
$newPartnerId="123456"
97+
$partner = Update-AzureRmManagementPartner -PartnerId $newPartnerId
98+
99+
# Assert
100+
Assert-AreEqual $newPartnerId $partner.PartnerId
101+
Assert-NotNull $partner.TenantId
102+
Assert-NotNull $partner.ObjectId
103+
Assert-NotNull $partner.State
104+
105+
# cleanup
106+
Remove-AzureRmManagementPartner -PartnerId $newPartnerId
107+
}
108+
109+
<#
110+
.SYNOPSIS
111+
Tests remove management partner
112+
#>
113+
function Test-RemovePartner
114+
{
115+
# Setup
116+
$partnerId="123457"
117+
$partner = New-AzureRmManagementPartner -PartnerId $partnerId
118+
119+
# Test
120+
Remove-AzureRmManagementPartner -PartnerId $partnerId
121+
}

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/ResourcesController.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
using Microsoft.Azure.ServiceManagemenet.Common.Models;
3939
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
4040
using Microsoft.Azure.Commands.Resources.Models.Gallery;
41+
using Microsoft.Azure.Management.ManagementPartner;
4142

4243
namespace Microsoft.Azure.Commands.Resources.Test.ScenarioTests
4344
{
@@ -66,6 +67,8 @@ public sealed class ResourcesController
6667
public InsightsClient InsightsClient { get; private set; }
6768

6869
public AuthorizationManagementClient AuthorizationManagementClient { get; private set; }
70+
public ACEProvisioningManagementPartnerAPIClient ACEProvisioningManagementPartnerAPIClient { get; private set; }
71+
6972

7073
public string UserDomain { get; private set; }
7174

@@ -182,6 +185,7 @@ private void SetupManagementClients(MockContext context)
182185
GraphClient = GetGraphClient(context);
183186
InsightsClient = GetInsightsClient();
184187
this.FeatureClient = this.GetFeatureClient(context);
188+
ACEProvisioningManagementPartnerAPIClient = GetACEProvisioningGSMAPIClient(context);
185189
var testEnvironment = this.csmTestFactory.GetTestEnvironment();
186190
var credentials = new SubscriptionCredentialsAdapter(
187191
testEnvironment.AuthorizationContext.TokenCredentials[Microsoft.Azure.Test.TokenAudience.Management],
@@ -196,7 +200,8 @@ private void SetupManagementClients(MockContext context)
196200
AuthorizationManagementClient,
197201
GraphClient,
198202
InsightsClient,
199-
this.FeatureClient);
203+
this.FeatureClient,
204+
ACEProvisioningManagementPartnerAPIClient);
200205
}
201206

202207
private GraphRbacManagementClient GetGraphClient(MockContext context)
@@ -270,6 +275,11 @@ private Internal.Subscriptions.SubscriptionClient GetSubscriptionClient(MockCont
270275
return context.GetServiceClient<Internal.Subscriptions.SubscriptionClient>(TestEnvironmentFactory.GetTestEnvironment());
271276
}
272277

278+
private ACEProvisioningManagementPartnerAPIClient GetACEProvisioningGSMAPIClient(MockContext context)
279+
{
280+
return context.GetServiceClient<ACEProvisioningManagementPartnerAPIClient>(TestEnvironmentFactory.GetTestEnvironment());
281+
}
282+
273283
private GalleryClient GetGalleryClient()
274284
{
275285
return LegacyTest.TestBase.GetServiceClient<GalleryClient>(this.csmTestFactory);

0 commit comments

Comments
 (0)