Skip to content

Commit 3ed7a91

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into master-fix
# Conflicts: # src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml # tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv
2 parents 1e0dbd9 + 2b7cd5b commit 3ed7a91

File tree

237 files changed

+94405
-8810
lines changed

Some content is hidden

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

237 files changed

+94405
-8810
lines changed

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@
517517
* DataFactory
518518
* Added new cmdlet for listing activity windows
519519
- Get-AzureRmDataFactoryActivityWindow
520+
* Fixed Get-AzureRmDataFactoryActivityWindow so it works for named pipeline and activity
520521
* DataLake
521522
* Changed parameter `Host` to `DatabaseHost` and added alias to `Host`
522523
- New-AzureRmDataLakeAnalyticsCatalogSecret

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ This repository contains a set of PowerShell cmdlets for developers and administ
2222
* App Service (Websites)
2323
* SQL Database
2424
* KeyVault
25+
* Data Lake Store
26+
* Data Lake Analytics
2527
* Operational Insights
2628
* Automation
2729
* Batch

documentation/Repo-Tasks-Module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
###### Usage:
44

55
1. Start .\tools\PS-VSPrompt.lnk (shortcut), this will start VS Dev Prompt in powershell
6-
2. Import-Module .\tools\Repo-Tasks.psd1
6+
2. Import-Module .\Repo-Tasks.psd1
77
1. During import, we allow to load additional functions that users might want to use it in their session.
88
2. If you have any userPreference.ps1 file under %userprofile%/psFiles directory, the module will try to load it by dot sourcing it.
99
2. It will also honor environment variable $env:psuserpreferences and load .ps1 files from the location that is pointed by $env:psuserpreferences
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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.Management.Storage;
16+
using Microsoft.WindowsAzure.Commands.Common.Storage;
17+
18+
namespace Microsoft.Azure.Commands.Management.Storage.Models
19+
{
20+
public class ARMStorageProvider : IStorageServiceProvider
21+
{
22+
IStorageManagementClient _client;
23+
24+
public ARMStorageProvider(IStorageManagementClient client)
25+
{
26+
_client = client;
27+
}
28+
public IStorageService GetStorageService(string name, string resourceGroupName)
29+
{
30+
var account = _client.StorageAccounts.GetProperties(resourceGroupName, name);
31+
var keys = _client.StorageAccounts.ListKeys(resourceGroupName, name);
32+
return new ARMStorageService(account, keys.Keys[0].Value,
33+
keys.Keys[1].Value);
34+
}
35+
}
36+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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.WindowsAzure.Commands.Common.Storage;
16+
using System;
17+
using System.Collections.Generic;
18+
19+
namespace Microsoft.Azure.Commands.Management.Storage.Models
20+
{
21+
public class ARMStorageService : IStorageService
22+
{
23+
Azure.Management.Storage.Models.StorageAccount _account;
24+
List<string> _authenticationKeys = new List<string>();
25+
public ARMStorageService(Azure.Management.Storage.Models.StorageAccount account,
26+
params string[] authenticationKeys)
27+
{
28+
_account = account;
29+
foreach (var key in authenticationKeys)
30+
{
31+
_authenticationKeys.Add(key);
32+
}
33+
}
34+
35+
public Uri BlobEndpoint
36+
{
37+
get { return GetUri(_account.PrimaryEndpoints.Blob); }
38+
}
39+
40+
public Uri FileEndpoint
41+
{
42+
get { return GetUri(_account.PrimaryEndpoints.File); }
43+
}
44+
45+
public Uri QueueEndpoint
46+
{
47+
get { return GetUri(_account.PrimaryEndpoints.Queue); }
48+
}
49+
50+
public Uri TableEndpoint
51+
{
52+
get { return GetUri(_account.PrimaryEndpoints.Table); }
53+
}
54+
55+
public string Name
56+
{
57+
get { return _account.Name; }
58+
}
59+
60+
public List<string> AuthenticationKeys
61+
{
62+
get { return _authenticationKeys; }
63+
}
64+
65+
/// <summary>
66+
/// Get the resource group name from a storage account resource Id
67+
/// </summary>
68+
/// <param name="resourceId">The resource Id for the storage account</param>
69+
/// <returns>The resource group containing the storage account</returns>
70+
public static string ParseResourceGroupFromId(string resourceId)
71+
{
72+
if (!string.IsNullOrEmpty(resourceId))
73+
{
74+
string[] tokens = resourceId.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
75+
if (tokens == null || tokens.Length < 4)
76+
{
77+
throw new ArgumentOutOfRangeException("resourceId");
78+
}
79+
return tokens[3];
80+
}
81+
return null;
82+
}
83+
84+
public static Uri GetUri(string uriString)
85+
{
86+
return uriString == null ? null : new Uri(uriString);
87+
}
88+
}
89+
}

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/AzureRM.Storage.ps1

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function Get-AzureRmStorageAccount
2121
$getTask = $client.StorageAccounts.GetPropertiesAsync($ResourceGroupName, $name, [System.Threading.CancellationToken]::None)
2222
}
2323
$sa = $getTask.Result
24-
$account = Get-StorageAccount $ResourceGroupName $Name
24+
$id = "/subscriptions/" + $context.Subscription.Id + "/resourceGroups/"+ $ResourceGroupName + "/providers/Microsoft.Storage/storageAccounts/" + $Name
25+
$account = Get-StorageAccount $ResourceGroupName $Name $id
2526
Write-Output $account
2627
}
2728
END {}
@@ -43,16 +44,32 @@ function New-AzureRmStorageAccount
4344
}
4445
PROCESS {
4546
$createParms = New-Object -Type Microsoft.Azure.Management.Storage.Models.StorageAccountCreateParameters
46-
if ($typeString -eq $null)
47-
{
48-
$Type = [Microsoft.Azure.Management.Storage.Models.AccountType]::StandardLRS
49-
}
50-
else
51-
{
52-
$Type = Parse-Type $typeString
53-
}
54-
55-
$createParms.AccountType = $Type
47+
if ($version.Major -lt 5)
48+
{
49+
if ($typeString -eq $null)
50+
{
51+
$Type = [Microsoft.Azure.Management.Storage.Models.AccountType]::StandardLRS
52+
}
53+
else
54+
{
55+
$Type = Parse-Type $typeString $version.Major
56+
}
57+
58+
$createParms.AccountType = $Type
59+
}
60+
else
61+
{
62+
if ($typeString -eq $null)
63+
{
64+
$Type = [Microsoft.Azure.Management.Storage.Models.SkuName]::StandardLRS
65+
}
66+
else
67+
{
68+
$Type = Parse-Type $typeString $version.Major
69+
}
70+
71+
$createParms.Sku = New-Object -Type Microsoft.Azure.Management.Storage.Models.Sku $Type
72+
}
5673
$createParms.Location = $Location
5774
if ($version.Major -gt 3)
5875
{
@@ -167,9 +184,16 @@ function Get-Context
167184

168185
function Parse-Type
169186
{
170-
param([string] $type)
187+
param([string] $type, [int] $majorVersion)
171188
$type = $type.Replace("_", "")
172-
$returnSkuName = [System.Enum]::Parse([Microsoft.Azure.Management.Storage.Models.AccountType], $type)
189+
if ($majorVersion -lt 5)
190+
{
191+
$returnSkuName = [System.Enum]::Parse([Microsoft.Azure.Management.Storage.Models.AccountType], $type)
192+
}
193+
else
194+
{
195+
$returnSkuName = [System.Enum]::Parse([Microsoft.Azure.Management.Storage.Models.SkuName], $type)
196+
}
173197
return $returnSkuName;
174198
}
175199

@@ -195,10 +219,10 @@ function Get-StorageClient
195219
}
196220

197221
function Get-StorageAccount {
198-
param([string] $resourceGroupName, [string] $name)
222+
param([string] $resourceGroupName, [string] $name, [string] $id)
199223
$endpoints = New-Object PSObject -Property @{"Blob" = "https://$name.blob.core.windows.net/"}
200224
$sa = New-Object PSObject -Property @{"Name" = $name; "ResourceGroupName" = $resourceGroupName;
201-
"PrimaryEndpoints" = $endpoints
225+
"PrimaryEndpoints" = $endpoints; "Id" = $id
202226
}
203227
return $sa
204228
}

src/ResourceManager/Compute/ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Updated Set-AzureRmVMDscExtension cmdlet WmfVersion parameter to support "5.1"
22+
23+
* Updated Set-AzureRmVMChefExtension cmdlet to add following new options :
24+
- Daemon: Configures the chef-client service for unattended execution. e.g. -Daemon 'none' or e.g. -Daemon 'service'."
25+
- Secret: The encryption key used to encrypt and decrypt the data bag item values.
26+
- SecretFile: The path to the file that contains the encryption key used to encrypt and decrypt the data bag item values.
2127

2228
## Version 2.6.0
2329
* New cmdlets for Managed disk

src/ResourceManager/Compute/Commands.Compute/Extension/Chef/SetAzureVMChefExtension.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public class SetAzureVMChefExtensionCommand : VirtualMachineExtensionBaseCmdlet
4848
private string JsonAttributeTemplate = "custom_json_attr";
4949
private string ChefServiceIntervalTemplate = "chef_service_interval";
5050
private string RunListTemplate = "runlist";
51+
private string DaemonTemplate = "daemon";
52+
private string SecretTemplate = "encrypted_data_bag_secret";
5153

5254
[Parameter(
5355
Mandatory = true,
@@ -114,6 +116,27 @@ public string TypeHandlerVersion
114116
[ValidateNotNullOrEmpty]
115117
public string ChefServiceInterval { get; set; }
116118

119+
[Parameter(
120+
ValueFromPipelineByPropertyName = true,
121+
HelpMessage = "Configures the chef-client service for unattended execution. The node platform should be Windows." +
122+
"Options: 'none' or 'service'." +
123+
"none - Currently prevents the chef-client service from being configured as a service." +
124+
"service - Configures the chef-client to run automatically in the background as a service.")]
125+
[ValidateNotNullOrEmpty]
126+
public string Daemon { get; set; }
127+
128+
[Parameter(
129+
ValueFromPipelineByPropertyName = true,
130+
HelpMessage = "The encryption key used to encrypt and decrypt the data bag item values.")]
131+
[ValidateNotNullOrEmpty]
132+
public string Secret { get; set; }
133+
134+
[Parameter(
135+
ValueFromPipelineByPropertyName = true,
136+
HelpMessage = "The path to the file that contains the encryption key used to encrypt and decrypt the data bag item values.")]
137+
[ValidateNotNullOrEmpty]
138+
public string SecretFile { get; set; }
139+
117140
[Parameter(
118141
ValueFromPipelineByPropertyName = true,
119142
HelpMessage = "The Chef Server Node Runlist.")]
@@ -228,6 +251,7 @@ private Hashtable PublicConfiguration
228251
bool IsJsonAttributeEmpty = string.IsNullOrEmpty(this.JsonAttribute);
229252
bool IsChefServiceIntervalEmpty = string.IsNullOrEmpty(this.ChefServiceInterval);
230253
string BootstrapVersion = string.IsNullOrEmpty(this.BootstrapVersion) ? "" : this.BootstrapVersion;
254+
bool IsDaemonEmpty = string.IsNullOrEmpty(this.Daemon);
231255

232256
//Cases handled:
233257
// 1. When clientRb given by user and:
@@ -300,6 +324,11 @@ private Hashtable PublicConfiguration
300324
hashTable.Add(ChefServiceIntervalTemplate, ChefServiceInterval);
301325
}
302326

327+
if (this.Windows.IsPresent && !IsDaemonEmpty)
328+
{
329+
hashTable.Add(DaemonTemplate, this.Daemon);
330+
}
331+
303332
this.publicConfiguration = hashTable;
304333
}
305334

@@ -314,6 +343,12 @@ private Hashtable PrivateConfiguration
314343
if (this.privateConfiguration == null)
315344
{
316345
var hashTable = new Hashtable();
346+
347+
if (!string.IsNullOrEmpty(this.SecretFile))
348+
hashTable.Add(SecretTemplate, File.ReadAllText(this.SecretFile).TrimEnd('\r', '\n'));
349+
else if (!string.IsNullOrEmpty(this.Secret))
350+
hashTable.Add(SecretTemplate, this.Secret);
351+
317352
hashTable.Add(PrivateConfigurationTemplate, File.ReadAllText(this.ValidationPem).TrimEnd('\r', '\n'));
318353
this.privateConfiguration = hashTable;
319354
}
@@ -398,12 +433,30 @@ private void ValidateParameters()
398433
bool IsClientRbEmpty = string.IsNullOrEmpty(this.ClientRb);
399434
bool IsChefServerUrlEmpty = string.IsNullOrEmpty(this.ChefServerUrl);
400435
bool IsValidationClientNameEmpty = string.IsNullOrEmpty(this.ValidationClientName);
436+
bool IsDaemonEmpty = string.IsNullOrEmpty(this.Daemon);
401437
// Validate ClientRb or ChefServerUrl and ValidationClientName should exist.
402438
if (IsClientRbEmpty && (IsChefServerUrlEmpty || IsValidationClientNameEmpty))
403439
{
404440
throw new ArgumentException(
405441
"Required -ClientRb or -ChefServerUrl and -ValidationClientName options.");
406442
}
443+
444+
if (!IsDaemonEmpty)
445+
{
446+
bool IsDaemonValueInvalid = Array.IndexOf(new String[2] {"none", "service"}, this.Daemon) == -1;
447+
// Validation against the invalid use of Daemon option.
448+
if (IsDaemonValueInvalid || this.Linux.IsPresent)
449+
{
450+
throw new ArgumentException(
451+
"Invalid use of -Daemon option.");
452+
}
453+
}
454+
455+
if (!string.IsNullOrEmpty(this.SecretFile) && !File.Exists(this.SecretFile))
456+
{
457+
throw new FileNotFoundException(
458+
"File specified in -SecretFile option does not exist.");
459+
}
407460
}
408461

409462
public override void ExecuteCmdlet()

src/ResourceManager/Compute/Commands.Compute/Extension/DSC/SetAzureVMDscExtensionCommand.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public class SetAzureVMDscExtensionCommand : VirtualMachineExtensionBaseCmdlet
187187
///
188188
/// The DSC Azure Extension depends on DSC features that are only available in
189189
/// the WMF updates. This parameter specifies which version of the update to
190-
/// install on the VM. The possible values are "4.0","5.0" ,"5.1PP" and "latest".
190+
/// install on the VM. The possible values are "4.0","5.0" ,"5.1" and "latest".
191191
///
192192
/// A value of "4.0" will install WMF 4.0 Update packages
193193
/// (https://support.microsoft.com/en-us/kb/3119938) on Windows 8.1 or Windows Server
@@ -198,15 +198,15 @@ public class SetAzureVMDscExtensionCommand : VirtualMachineExtensionBaseCmdlet
198198
/// A value of "5.0" will install the latest release of WMF 5.0
199199
/// (https://www.microsoft.com/en-us/download/details.aspx?id=50395).
200200
///
201-
/// A value of "5.1PP" will install the WMF 5.1 preview
202-
/// (https://www.microsoft.com/en-us/download/details.aspx?id=53347).
201+
/// A value of "5.1" will install the WMF 5.1
202+
/// (https://www.microsoft.com/en-us/download/details.aspx?id=54616).
203203
///
204-
/// A value of "latest" will install the latest WMF, currently WMF 5.0
204+
/// A value of "latest" will install the latest WMF, currently WMF 5.1
205205
///
206206
/// The default value is "latest"
207207
/// </summary>
208208
[Parameter(ValueFromPipelineByPropertyName = true)]
209-
[ValidateSetAttribute(new[] { "4.0", "5.0", "5.1PP", "latest" })]
209+
[ValidateSetAttribute(new[] {"4.0", "5.0", "5.1", "latest"})]
210210
public string WmfVersion { get; set; }
211211

212212
/// <summary>

0 commit comments

Comments
 (0)