Skip to content

Commit 5277e22

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into Policy
2 parents 3da0945 + 3eb1938 commit 5277e22

File tree

101 files changed

+18732
-2127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+18732
-2127
lines changed

ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@
5151
* Set-AzureVMSqlServerExtension
5252
* Get-AzureVMSqlServerExtension
5353
* Remove-AzureVMSqlServerExtension
54+
* Azure SQL Database Index Recommendation Cmdlets
55+
* Get-AzureSqlDatabaseIndexRecommendations
56+
* Start-AzureSqlDatabaseExecuteIndexRecommendation
57+
* Stop-AzureSqlDatabaseExecuteIndexRecommendation
58+
* Azure SQL Database and Server Upgrade Hints Cmdlets
59+
* Get-AzureSqlDatabaseUpgradeHint
60+
* Get-AzureSqlServerUpgradeHint
5461

5562
## 2015.08.17 version 0.9.7
5663
* Azure Profile cmdlets

src/ResourceManager/Automation/Commands.Automation.Test/packages.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1717
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
1818
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
19-
<package id="xunit.runner.visualstudio" version="2.1.0-beta4-build1109" targetFramework="net45" />
2019
<package id="xunit" version="1.9.2" targetFramework="net45" />
2120
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />
2221
<package id="xunit.runner.visualstudio" version="2.1.0-beta4-build1109" targetFramework="net45" />

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/Commands.AzureBackup.Test.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
<Private>True</Private>
4141
</Reference>
4242
<Reference Include="Microsoft.Azure.Management.BackupServicesManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
43-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.4-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.5-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
4445
</Reference>
4546
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
4647
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/AzureBackup/Commands.AzureBackup.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.3.1-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.4-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.5-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
99
<package id="Microsoft.Azure.Test.Framework" version="1.0.5715.36130-prerelease" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5715.36130-prerelease" targetFramework="net45" />

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/EnableAzureRMBackupContainerReregistration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ protected override void ProcessRecord()
4646
{
4747
case AzureBackupContainerType.Windows:
4848
case AzureBackupContainerType.SCDPM:
49+
case AzureBackupContainerType.AzureBackupServer:
50+
case AzureBackupContainerType.Other:
4951
AzureBackupClient.EnableMachineContainerReregistration(Container.ResourceGroupName, Container.ResourceName, Container.Id);
5052
break;
5153
default:

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureRMBackupContainer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ protected override void ProcessRecord()
6060
{
6161
case AzureBackupContainerType.Windows:
6262
case AzureBackupContainerType.SCDPM:
63+
case AzureBackupContainerType.AzureBackupServer:
64+
case AzureBackupContainerType.Other:
6365
containers.AddRange(GetMachineContainers(Vault.ResourceGroupName, Vault.Name));
6466
break;
6567
case AzureBackupContainerType.AzureVM:

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/UnregisterAzureRMBackupContainer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ protected override void ProcessRecord()
4747
{
4848
case AzureBackupContainerType.Windows:
4949
case AzureBackupContainerType.SCDPM:
50+
case AzureBackupContainerType.AzureBackupServer:
51+
case AzureBackupContainerType.Other:
5052
DeleteServer();
5153
break;
5254
case AzureBackupContainerType.AzureVM:

src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
5858
</Reference>
5959
<Reference Include="Microsoft.Azure.Management.BackupServicesManagement, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
60-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.4-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
60+
<SpecificVersion>False</SpecificVersion>
61+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.BackupServices.1.0.5-preview\lib\net40\Microsoft.Azure.Management.BackupServicesManagement.dll</HintPath>
6162
</Reference>
6263
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6364
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/AzureBackup/Commands.AzureBackup/Helpers/ContainerHelpers.cs

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,33 +38,37 @@ internal class ContainerHelpers
3838
{
3939
private static readonly Regex ResourceGroupRegex = new Regex(@"/subscriptions/(?<subscriptionsId>.+)/resourceGroups/(?<resourceGroupName>.+)/providers/(?<providersName>.+)/BackupVault/(?<BackupVaultName>.+)/containers/(?<containersName>.+)", RegexOptions.Compiled);
4040

41-
internal static AzureBackupContainerType GetContainerType(string customerType)
41+
internal static AzureBackupContainerType GetContainerType(string customerTypeString)
4242
{
43-
CustomerType type = (CustomerType)Enum.Parse(typeof(CustomerType), customerType);
44-
4543
AzureBackupContainerType containerType = 0;
44+
CustomerType customerType = CustomerType.Invalid;
4645

47-
switch (type)
46+
if (Enum.TryParse<CustomerType>(customerTypeString, out customerType))
4847
{
49-
case CustomerType.DPM:
50-
containerType = AzureBackupContainerType.SCDPM;
51-
break;
52-
case CustomerType.InMage:
53-
break;
54-
case CustomerType.Invalid:
55-
break;
56-
case CustomerType.ManagedContainer:
57-
break;
58-
case CustomerType.OBS:
59-
containerType = AzureBackupContainerType.Windows;
60-
break;
61-
case CustomerType.SBS:
62-
containerType = AzureBackupContainerType.Windows;
63-
break;
64-
case CustomerType.SqlPaaS:
65-
break;
66-
default:
67-
break;
48+
switch (customerType)
49+
{
50+
case CustomerType.DPM:
51+
containerType = AzureBackupContainerType.SCDPM;
52+
break;
53+
case CustomerType.OBS:
54+
containerType = AzureBackupContainerType.Windows;
55+
break;
56+
case CustomerType.SBS:
57+
containerType = AzureBackupContainerType.Windows;
58+
break;
59+
case CustomerType.DPMVenus:
60+
containerType = AzureBackupContainerType.AzureBackupServer;
61+
break;
62+
case CustomerType.Invalid:
63+
break;
64+
default:
65+
containerType = AzureBackupContainerType.Other;
66+
break;
67+
}
68+
}
69+
else if (!string.IsNullOrEmpty(customerTypeString))
70+
{
71+
containerType = AzureBackupContainerType.Other;
6872
}
6973

7074
return containerType;

src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupEnums.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public enum AzureBackupContainerType
2525
Windows = 1,
2626
SCDPM,
2727
AzureVM,
28+
AzureBackupServer,
29+
Other,
2830
}
2931

3032
public enum DataSourceType

src/ResourceManager/AzureBackup/Commands.AzureBackup/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.3.1-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.4-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Management.BackupServices" version="1.0.5-preview" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
99
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
1010
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />

src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchTestHelpers.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System.Linq;
16-
using System.Net;
17-
using System.Threading.Tasks;
1815
using Microsoft.Azure.Batch;
1916
using Microsoft.Azure.Batch.Protocol;
2017
using Microsoft.Azure.Management.Batch.Models;
2118
using System;
2219
using System.Collections;
2320
using System.Collections.Generic;
21+
using System.Net;
2422
using System.Reflection;
23+
using System.Threading.Tasks;
2524
using Xunit;
2625
using ProxyModels = Microsoft.Azure.Batch.Protocol.Models;
2726

src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@
280280
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.BatchAccountTests\TestUpdatesExistingBatchAccount.json">
281281
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
282282
</None>
283+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestGetAndListComputeNodesWithSelect.json">
284+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
285+
</None>
283286
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ComputeNodeTests\TestGetComputeNodeById.json">
284287
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
285288
</None>
@@ -382,6 +385,9 @@
382385
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobScheduleTests\TestDisableAndEnableJobSchedule.json">
383386
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
384387
</None>
388+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobScheduleTests\TestGetAndListJobSchedulesWithSelect.json">
389+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
390+
</None>
385391
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobScheduleTests\TestGetJobScheduleById.json">
386392
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
387393
</None>
@@ -415,6 +421,9 @@
415421
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobTests\TestDisableAndEnableJob.json">
416422
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
417423
</None>
424+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobTests\TestGetAndListJobsWithSelect.json">
425+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
426+
</None>
418427
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.JobTests\TestGetJobById.json">
419428
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
420429
</None>
@@ -472,6 +481,9 @@
472481
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestEvaluateAutoScaleByPipeline.json">
473482
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
474483
</None>
484+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestGetAndListPoolsWithSelect.json">
485+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
486+
</None>
475487
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.PoolTests\TestGetPoolById.json">
476488
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
477489
</None>
@@ -511,6 +523,9 @@
511523
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.TaskTests\TestDeleteTaskPipeline.json">
512524
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
513525
</None>
526+
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.TaskTests\TestGetAndListTasksWithSelect.json">
527+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
528+
</None>
514529
<None Include="SessionRecords\Microsoft.Azure.Commands.Batch.Test.ScenarioTests.TaskTests\TestGetTaskById.json">
515530
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
516531
</None>

src/ResourceManager/AzureBatch/Commands.Batch.Test/ComputeNodes/GetBatchComputeNodeCommandTests.cs

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using System.Collections.Generic;
2222
using System.Linq;
2323
using System.Management.Automation;
24+
using System.Threading.Tasks;
2425
using Xunit;
2526
using BatchClient = Microsoft.Azure.Commands.Batch.Models.BatchClient;
2627

@@ -72,39 +73,63 @@ public void GetBatchComputeNodeTest()
7273

7374
[Fact]
7475
[Trait(Category.AcceptanceType, Category.CheckIn)]
75-
public void ListBatchComputeNodesByODataFilterTest()
76+
public void GetBatchComputeNodeODataTest()
7677
{
77-
// Setup cmdlet to list vms using an OData filter.
78+
// Setup cmdlet to get a single compute node
7879
BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
7980
cmdlet.BatchContext = context;
80-
cmdlet.PoolId = "pool";
81-
cmdlet.Id = null;
82-
cmdlet.Filter = "state -eq 'idle'";
81+
cmdlet.PoolId = "testPool";
82+
cmdlet.Id = "computeNode1";
83+
cmdlet.Select = "id,state";
8384

84-
string[] idsOfConstructedComputeNodes = new[] { "computeNode1", "computeNode2" };
85+
string requestSelect = null;
8586

86-
// Build some compute nodes instead of querying the service on a List ComputeNodes call
87-
ComputeNodeListResponse response = BatchTestHelpers.CreateComputeNodeListResponse(idsOfConstructedComputeNodes);
88-
RequestInterceptor interceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor<ComputeNodeListParameters, ComputeNodeListResponse>(response);
89-
cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { interceptor };
87+
// Fetch the OData clauses off the request. The OData clauses are applied after user provided RequestInterceptors, so a ResponseInterceptor is used.
88+
ComputeNodeGetResponse getResponse = BatchTestHelpers.CreateComputeNodeGetResponse(cmdlet.Id);
89+
RequestInterceptor requestInterceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor<ComputeNodeGetParameters, ComputeNodeGetResponse>(getResponse);
90+
ResponseInterceptor responseInterceptor = new ResponseInterceptor((response, request) =>
91+
{
92+
requestSelect = request.Parameters.DetailLevel.SelectClause;
9093

91-
// Setup the cmdlet to write pipeline output to a list that can be examined later
92-
List<PSComputeNode> pipeline = new List<PSComputeNode>();
93-
commandRuntimeMock.Setup(r =>
94-
r.WriteObject(It.IsAny<PSComputeNode>()))
95-
.Callback<object>(c => pipeline.Add((PSComputeNode)c));
94+
return Task.FromResult(response);
95+
});
96+
cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { requestInterceptor, responseInterceptor };
9697

9798
cmdlet.ExecuteCmdlet();
9899

99-
// Verify that the cmdlet wrote the constructed compute nodes to the pipeline
100-
Assert.Equal(2, pipeline.Count);
101-
int computeNodeCount = 0;
102-
foreach (PSComputeNode c in pipeline)
100+
Assert.Equal(cmdlet.Select, requestSelect);
101+
}
102+
103+
[Fact]
104+
[Trait(Category.AcceptanceType, Category.CheckIn)]
105+
public void ListBatchComputeNodesODataTest()
106+
{
107+
// Setup cmdlet to list compute nodes using an OData filter
108+
BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys();
109+
cmdlet.BatchContext = context;
110+
cmdlet.PoolId = "testPool";
111+
cmdlet.Id = null;
112+
cmdlet.Filter = "startswith(id,'test')";
113+
cmdlet.Select = "id,state";
114+
115+
string requestFilter = null;
116+
string requestSelect = null;
117+
118+
// Fetch the OData clauses off the request. The OData clauses are applied after user provided RequestInterceptors, so a ResponseInterceptor is used.
119+
RequestInterceptor requestInterceptor = BatchTestHelpers.CreateFakeServiceResponseInterceptor<ComputeNodeListParameters, ComputeNodeListResponse>();
120+
ResponseInterceptor responseInterceptor = new ResponseInterceptor((response, request) =>
103121
{
104-
Assert.True(idsOfConstructedComputeNodes.Contains(c.Id));
105-
computeNodeCount++;
106-
}
107-
Assert.Equal(idsOfConstructedComputeNodes.Length, computeNodeCount);
122+
requestFilter = request.Parameters.DetailLevel.FilterClause;
123+
requestSelect = request.Parameters.DetailLevel.SelectClause;
124+
125+
return Task.FromResult(response);
126+
});
127+
cmdlet.AdditionalBehaviors = new List<BatchClientBehavior>() { requestInterceptor, responseInterceptor };
128+
129+
cmdlet.ExecuteCmdlet();
130+
131+
Assert.Equal(cmdlet.Filter, requestFilter);
132+
Assert.Equal(cmdlet.Select, requestSelect);
108133
}
109134

110135
[Fact]

0 commit comments

Comments
 (0)