Skip to content

Commit c843cca

Browse files
committed
Merge branch 'dev' of github.com:azure/azure-powershell into galleryclean
2 parents 3d24778 + 484f3bd commit c843cca

File tree

22 files changed

+4707
-369
lines changed

22 files changed

+4707
-369
lines changed

src/ResourceManager/DataFactories/Commands.DataFactories.Test/Commands.DataFactories.Test.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@
9595
<SpecificVersion>False</SpecificVersion>
9696
<HintPath>..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
9797
</Reference>
98+
<Reference Include="Microsoft.DataTransfer.Gateway.Encryption, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
99+
<SpecificVersion>False</SpecificVersion>
100+
<HintPath>..\..\..\packages\Microsoft.DataTransfer.Gateway.Encryption.1.7.5798-preview-001\lib\net45\Microsoft.DataTransfer.Gateway.Encryption.dll</HintPath>
101+
</Reference>
98102
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory">
99103
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
100104
</Reference>

src/ResourceManager/DataFactories/Commands.DataFactories.Test/UnitTests/NewDataFactoryEncryptValueTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using Microsoft.Azure.Commands.DataFactories;
1616
using Microsoft.Azure.Commands.DataFactories.Test;
17+
using Microsoft.DataTransfer.Gateway.Encryption;
1718
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1819
using Moq;
1920
using System;
@@ -109,5 +110,24 @@ public void TestOnPremDatasourceEncryptionWinAuth()
109110
this.dataFactoriesClientMock.Verify(f => f.OnPremisesEncryptString(secureString, ResourceGroupName, DataFactoryName, GatewayName, credential, linkedServiceType, nonCredentialValue, authenticationType, serverName, databaseName), Times.Once());
110111
this.commandRuntimeMock.Verify(f => f.WriteObject(expectedOutput), Times.Once());
111112
}
113+
114+
[Fact]
115+
[Trait(Category.AcceptanceType, Category.CheckIn)]
116+
public void TestOnPremDatasourceEncryption_LinkedServiceTypeParsing()
117+
{
118+
// Built-in linked service types
119+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesSqlLinkedService") == LinkedServiceType.OnPremisesSqlLinkedService);
120+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesFileSystemLinkedService") == LinkedServiceType.OnPremisesFileSystemLinkedService);
121+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesOracleLinkedService") == LinkedServiceType.OnPremisesOracleLinkedService);
122+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesOdbcLinkedService") == LinkedServiceType.OnPremisesOdbcLinkedService);
123+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesPostgreSqlLinkedService") == LinkedServiceType.OnPremisesPostgreSqlLinkedService);
124+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesTeradataLinkedService") == LinkedServiceType.OnPremisesTeradataLinkedService);
125+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesMySQLLinkedService") == LinkedServiceType.OnPremisesMySQLLinkedService);
126+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesDB2LinkedService") == LinkedServiceType.OnPremisesDB2LinkedService);
127+
Assert.True(DataFactoryClient.GetLinkedServiceType("OnPremisesSybaseLinkedService") == LinkedServiceType.OnPremisesSybaseLinkedService);
128+
129+
// Generic linked service types should be converted to Unknown type
130+
Assert.True(DataFactoryClient.GetLinkedServiceType("HdfsLinkedService") == LinkedServiceType.Unknown);
131+
}
112132
}
113133
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net45" />
1818
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net45" />
1919
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net45" />
20+
<package id="Microsoft.DataTransfer.Gateway.Encryption" version="1.7.5798-preview-001" targetFramework="net45" />
2021
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.18.206251556" targetFramework="net45" />
2122
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
2223
<package id="Microsoft.Rest.ClientRuntime" version="1.4.1" targetFramework="net45" />

src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@
8585
<SpecificVersion>False</SpecificVersion>
8686
<HintPath>..\..\..\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
8787
</Reference>
88-
<Reference Include="Microsoft.DataTransfer.Gateway.Encryption, Version=1.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
88+
<Reference Include="Microsoft.DataTransfer.Gateway.Encryption, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8989
<SpecificVersion>False</SpecificVersion>
90-
<HintPath>..\..\..\packages\Microsoft.DataTransfer.Gateway.Encryption.1.5.1-preview\lib\net45\Microsoft.DataTransfer.Gateway.Encryption.dll</HintPath>
90+
<HintPath>..\..\..\packages\Microsoft.DataTransfer.Gateway.Encryption.1.7.5798-preview-001\lib\net45\Microsoft.DataTransfer.Gateway.Encryption.dll</HintPath>
9191
</Reference>
9292
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.18.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9393
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>

src/ResourceManager/DataFactories/Commands.DataFactories/Encrypt/NewAzureDataFactoryEncryptValueCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class NewAzureDataFactoryEncryptValueCommand : DataFactoryBaseCmdlet
5252
HelpMessage = "The linked service type.")]
5353
[ValidateSet("OnPremisesSqlLinkedService", "OnPremisesFileSystemLinkedService", "OnPremisesOracleLinkedService",
5454
"OnPremisesOdbcLinkedService", "OnPremisesPostgreSqlLinkedService", "OnPremisesTeradataLinkedService",
55-
"OnPremisesMySQLLinkedService", "OnPremisesDB2LinkedService", "OnPremisesSybaseLinkedService",
55+
"OnPremisesMySQLLinkedService", "OnPremisesDB2LinkedService", "OnPremisesSybaseLinkedService",
56+
"HdfsLinkedService",
5657
IgnoreCase = true)]
5758
public string Type { get; set; }
5859

src/ResourceManager/DataFactories/Commands.DataFactories/Models/DataFactoryClient.Encrypt.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public virtual string OnPremisesEncryptString(SecureString value,
3232
string authenticationType,
3333
string serverName, string databaseName)
3434
{
35-
LinkedServiceType linkedServiceType = type == null ? LinkedServiceType.OnPremisesSqlLinkedService : (LinkedServiceType)Enum.Parse(typeof(LinkedServiceType), type, true);
35+
LinkedServiceType linkedServiceType = type == null ? LinkedServiceType.OnPremisesSqlLinkedService : GetLinkedServiceType(type);
3636

3737
if (linkedServiceType == LinkedServiceType.OnPremisesSqlLinkedService && linkedServiceType == LinkedServiceType.OnPremisesOracleLinkedService
3838
&& linkedServiceType == LinkedServiceType.OnPremisesFileSystemLinkedService && (value == null || value.Length == 0))
@@ -59,5 +59,17 @@ public virtual string OnPremisesEncryptString(SecureString value,
5959
UserInputConnectionString connectionString = new UserInputConnectionString(value, nonCredentialValue, userName, password, linkedServiceType, authType, serverName, databaseName);
6060
return GatewayEncryptionClient.Encrypt(connectionString, gatewayEncryptionInfos);
6161
}
62+
63+
internal static LinkedServiceType GetLinkedServiceType(string typeName)
64+
{
65+
LinkedServiceType result;
66+
if (!Enum.TryParse<LinkedServiceType>(typeName, true, out result))
67+
{
68+
// Treat any non-existing type as a generic data source type for encryption
69+
return LinkedServiceType.Unknown;
70+
}
71+
72+
return result;
73+
}
6274
}
6375
}

src/ResourceManager/DataFactories/Commands.DataFactories/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net45" />
1414
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net45" />
1515
<package id="Microsoft.Data.Services.Client" version="5.6.4" targetFramework="net45" />
16-
<package id="Microsoft.DataTransfer.Gateway.Encryption" version="1.5.1-preview" targetFramework="net45" />
16+
<package id="Microsoft.DataTransfer.Gateway.Encryption" version="1.7.5798-preview-001" targetFramework="net45" />
1717
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.18.206251556" targetFramework="net45" />
1818
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
1919
<package id="Microsoft.Rest.ClientRuntime" version="1.4.1" targetFramework="net45" />

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@
324324
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.ActiveDirectoryTests\TestGetADUserWithMail.json">
325325
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
326326
</None>
327+
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentTests\TestNestedDeploymentFromTemplateFile.json">
328+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
329+
</None>
327330
<None Include="SessionRecords\Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentTests\TestNewDeploymentFromTemplateFile.json">
328331
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
329332
</None>
@@ -553,6 +556,12 @@
553556
<None Include="sampleTemplateParams.json">
554557
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
555558
</None>
559+
<None Include="sampleNestedTemplate.json">
560+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
561+
</None>
562+
<None Include="sampleNestedTemplateParams.json">
563+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
564+
</None>
556565
</ItemGroup>
557566
<ItemGroup>
558567
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public void TestNewDeploymentFromTemplateFile()
3030
ResourcesController.NewInstance.RunPsTest("Test-NewDeploymentFromTemplateFile");
3131
}
3232

33+
[Fact]
34+
public void TestNestedDeploymentFromTemplateFile()
35+
{
36+
ResourcesController.NewInstance.RunPsTest("Test-NestedDeploymentFromTemplateFile");
37+
}
38+
3339
[Fact(Skip = "Fix acquisition of TenantId in KeyVault Test.")]
3440
public void TestNewDeploymentWithKeyVaultReference()
3541
{

src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/DeploymentTests.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,41 @@ function Test-NewDeploymentFromTemplateFile
6868
}
6969
}
7070

71+
<#
72+
.SYNOPSIS
73+
Tests nested deployment.
74+
#>
75+
function Test-NestedDeploymentFromTemplateFile
76+
{
77+
# Setup
78+
$rgname = Get-ResourceGroupName
79+
$rname = Get-ResourceName
80+
$rglocation = Get-ProviderLocation ResourceManagement
81+
$location = Get-ProviderLocation "Microsoft.Web/sites"
82+
83+
try
84+
{
85+
# Test
86+
New-AzureRmResourceGroup -Name $rgname -Location $rglocation
87+
88+
$deployment = New-AzureRmResourceGroupDeployment -Name $rname -ResourceGroupName $rgname -TemplateFile sampleNestedTemplate.json -TemplateParameterFile sampleNestedTemplateParams.json
89+
90+
# Assert
91+
Assert-AreEqual Succeeded $deployment.ProvisioningState
92+
93+
$subId = (Get-AzureRmContext).Subscription.SubscriptionId
94+
$deploymentId = "/subscriptions/$subId/resourcegroups/$rgname/providers/Microsoft.Resources/deployments/$rname"
95+
$getById = Get-AzureRmResourceGroupDeployment -Id $deploymentId
96+
Assert-AreEqual $getById.DeploymentName $deployment.DeploymentName
97+
}
98+
99+
finally
100+
{
101+
# Cleanup
102+
Clean-ResourceGroup $rgname
103+
}
104+
}
105+
71106
<#
72107
.SYNOPSIS
73108
Tests deployment via template file and parameter file with KeyVault reference.

src/ResourceManager/Resources/Commands.Resources.Test/SessionRecords/Microsoft.Azure.Commands.Resources.Test.ScenarioTests.DeploymentTests/TestNestedDeploymentFromTemplateFile.json

Lines changed: 4299 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"StorageAccountName": {
6+
"type": "String"
7+
}
8+
},
9+
"variables": {
10+
"templatelink": "https://raw.githubusercontent.com/vivsriaus/armtemplates/master/newStorageAccount.json"
11+
},
12+
"resources": [{
13+
"apiVersion": "2015-01-01",
14+
"name": "nestedTemplate",
15+
"type": "Microsoft.Resources/deployments",
16+
"properties": {
17+
"mode": "incremental",
18+
"templateLink": {
19+
"uri": "[variables('templatelink')]",
20+
"contentVersion": "1.0.0.0"
21+
},
22+
"parameters": {
23+
"StorageAccountName": {
24+
"value": "[parameters('StorageAccountName')]"
25+
}
26+
}
27+
}
28+
}]
29+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"StorageAccountName": {
6+
"value": "testvivek52134"
7+
}
8+
}
9+
}

src/ResourceManager/Resources/Commands.Resources/Models.ResourceGroups/ResourceClient.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using Hyak.Common;
2424
using Microsoft.Azure.Commands.Resources.Models.Authorization;
2525
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
26+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
2627
using Microsoft.Azure.Commands.Tags.Model;
2728
using Microsoft.Azure.Common.Authentication;
2829
using Microsoft.Azure.Common.Authentication.Models;
@@ -34,6 +35,7 @@
3435
using Microsoft.WindowsAzure.Commands.Utilities.Common;
3536
using Newtonsoft.Json;
3637
using ProjectResources = Microsoft.Azure.Commands.Resources.Properties.Resources;
38+
using System.Net;
3739

3840
namespace Microsoft.Azure.Commands.Resources.Models
3941
{
@@ -340,16 +342,21 @@ private List<DeploymentOperation> GetNewOperations(List<DeploymentOperation> old
340342
//If nested deployment, get the operations under those deployments as well
341343
if(operation.Properties.TargetResource.ResourceType.Equals(Constants.MicrosoftResourcesDeploymentType, StringComparison.OrdinalIgnoreCase))
342344
{
343-
List<DeploymentOperation> newNestedOperations = new List<DeploymentOperation>();
344-
DeploymentOperationsListResult result;
345+
HttpStatusCode statusCode;
346+
Enum.TryParse<HttpStatusCode>(operation.Properties.StatusCode, out statusCode);
347+
if(!statusCode.IsClientFailureRequest())
348+
{
349+
List<DeploymentOperation> newNestedOperations = new List<DeploymentOperation>();
350+
DeploymentOperationsListResult result;
345351

346-
result = ResourceManagementClient.DeploymentOperations.List(
347-
resourceGroupName: ResourceIdUtility.GetResourceGroupName(operation.Properties.TargetResource.Id),
348-
deploymentName: operation.Properties.TargetResource.ResourceName,
349-
parameters: null);
352+
result = ResourceManagementClient.DeploymentOperations.List(
353+
resourceGroupName: ResourceIdUtility.GetResourceGroupName(operation.Properties.TargetResource.Id),
354+
deploymentName: operation.Properties.TargetResource.ResourceName,
355+
parameters: null);
350356

351-
newNestedOperations = GetNewOperations(operations, result.Operations);
352-
newOperations.AddRange(newNestedOperations);
357+
newNestedOperations = GetNewOperations(operations, result.Operations);
358+
newOperations.AddRange(newNestedOperations);
359+
}
353360
}
354361
}
355362

src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Commands.StreamAnalytics.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.19.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6767
</Reference>
6868
<Reference Include="Microsoft.Azure.Management.StreamAnalytics">
69-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.1.7.0\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll</HintPath>
69+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.1.7.1\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll</HintPath>
7070
</Reference>
7171
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7272
<SpecificVersion>False</SpecificVersion>

src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/Resources/Job.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
"properties": {
1313
"type": "stream",
1414
"serialization": {
15-
"type": "CSV",
15+
"type": "JSON",
1616
"properties": {
17-
"fieldDelimiter": ",",
1817
"encoding": "UTF8"
1918
}
2019
},

src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics.Test/ScenarioTests/EndToEndTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function Test-TestStreamingAnalyticsE2E
6969
Assert-AreEqual $expected $actual.CurrentCount
7070

7171
# Start Job
72-
$actual = Start-AzureRmStreamAnalyticsJob -Name $jobName -ResourceGroupName $resourceGroup
72+
$actual = Start-AzureRmStreamAnalyticsJob -Name $jobName -ResourceGroupName $resourceGroup -OutputStartMode CustomTime -OutputStartTime 2012-12-12T12:12:12Z
7373
$expected = "True"
7474
Assert-AreEqual $expected $actual
7575

0 commit comments

Comments
 (0)