Skip to content

Commit 772da26

Browse files
committed
Merge pull request #128 from Azure/dev
.
2 parents c2cf2c1 + 157095e commit 772da26

File tree

14 files changed

+5202
-1283
lines changed

14 files changed

+5202
-1283
lines changed

setup/azurecmdfiles.wxi

Lines changed: 56 additions & 0 deletions
Large diffs are not rendered by default.

src/Common/Storage/Commands.Storage/Blob/Cmdlet/StartAzureStorageBlobCopy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public string SrcContainer
173173
[Parameter(HelpMessage = "Source Azure Storage Context Object", ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = FileParameterSet)]
174174
[Parameter(HelpMessage = "Source Azure Storage Context Object", ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, ParameterSetName = FileToBlobParameterSet)]
175175
[Parameter(HelpMessage = "Source Azure Storage Context Object", ParameterSetName = UriParameterSet)]
176-
public new AzureStorageContext Context { get; set; }
176+
public override AzureStorageContext Context { get; set; }
177177

178178
[Parameter(HelpMessage = "Destination Storage context object", Mandatory = false)]
179179
public AzureStorageContext DestContext { get; set; }

src/Common/Storage/Commands.Storage/Common/StorageCloudCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class StorageCloudCmdletBase<T> : CloudBaseCmdlet<T>
4343
{
4444
[Parameter(HelpMessage = "Azure Storage Context Object",
4545
ValueFromPipelineByPropertyName = true)]
46-
public AzureStorageContext Context { get; set; }
46+
public virtual AzureStorageContext Context { get; set; }
4747

4848
[Parameter(HelpMessage = "The server time out for each request in seconds.")]
4949
public virtual int? ServerTimeoutPerRequest { get; set; }

src/Common/Storage/Commands.Storage/File/AzureStorageFileCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public abstract class AzureStorageFileCmdletBase : StorageCloudCmdletBase<IStora
3434
ValueFromPipeline = true,
3535
ParameterSetName = Constants.SpecificParameterSetName,
3636
HelpMessage = "Azure Storage Context Object")]
37-
public new AzureStorageContext Context { get; set; }
37+
public override AzureStorageContext Context { get; set; }
3838

3939
protected FileRequestOptions RequestOptions
4040
{

src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageFileSasToken.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public string Policy
121121
ValueFromPipeline = true,
122122
HelpMessage = "Azure Storage Context Object",
123123
ParameterSetName = NameSasPolicyParmeterSet)]
124-
public new AzureStorageContext Context { get; set; }
124+
public override AzureStorageContext Context { get; set; }
125125

126126
/// <summary>
127127
/// Execute command

src/Common/Storage/Commands.Storage/File/Cmdlet/NewAzureStorageShareSasToken.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public string Policy
6868
[Parameter(
6969
ValueFromPipeline = true,
7070
HelpMessage = "Azure Storage Context Object")]
71-
public new AzureStorageContext Context { get; set; }
71+
public override AzureStorageContext Context { get; set; }
7272

7373
// Overwrite the useless parameter
7474
public override int? ServerTimeoutPerRequest { get; set; }

src/Common/Storage/Commands.Storage/File/Cmdlet/StartAzureStorageFileCopy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public class StartAzureStorageFileCopyCommand : StorageFileDataManagementCmdletB
120120
Mandatory = false,
121121
ValueFromPipelineByPropertyName = true,
122122
ParameterSetName = ShareNameParameterSet)]
123-
public new AzureStorageContext Context { get; set; }
123+
public override AzureStorageContext Context { get; set; }
124124

125125
[Parameter(HelpMessage = "Destination Storage context object", ParameterSetName = ContainerNameParameterSet)]
126126
[Parameter(HelpMessage = "Destination Storage context object", ParameterSetName = ContainerParameterSet)]
Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,3 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<Types>
3-
<Type>
4-
<Name>Microsoft.WindowsAzure.Storage.File.CloudFile</Name>
5-
<Members>
6-
<ScriptProperty>
7-
<Name>DirectoryTag</Name>
8-
<GetScriptBlock>[string]::Empty</GetScriptBlock>
9-
</ScriptProperty>
10-
<ScriptProperty>
11-
<Name>IsDirectory</Name>
12-
<GetScriptBlock>$false</GetScriptBlock>
13-
</ScriptProperty>
14-
<ScriptProperty>
15-
<Name>Length</Name>
16-
<GetScriptBlock>$_.Properties.Length</GetScriptBlock>
17-
</ScriptProperty>
18-
</Members>
19-
</Type>
20-
<Type>
21-
<Name>Microsoft.WindowsAzure.Storage.File.CloudFileDirectory</Name>
22-
<Members>
23-
<ScriptProperty>
24-
<Name>DirectoryTag</Name>
25-
<GetScriptBlock>"DIR"</GetScriptBlock>
26-
</ScriptProperty>
27-
<ScriptProperty>
28-
<Name>IsDirectory</Name>
29-
<GetScriptBlock>$true</GetScriptBlock>
30-
</ScriptProperty>
31-
<ScriptProperty>
32-
<Name>Length</Name>
33-
<GetScriptBlock>[string]::Empty</GetScriptBlock>
34-
</ScriptProperty>
35-
</Members>
36-
</Type>
373
</Types>

src/ResourceManager/Storage/Commands.Management.Storage/Microsoft.Azure.Commands.Management.Storage.dll-Help.xml

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<maml:paragraph>PS C:\&gt;</maml:paragraph>
122122
</maml:introduction>
123123
<dev:code>PS C:\&gt; #Get one storage account
124-
Get-AzureRmStorageAccount -ResourceGroupName &quot;RG1&quot; -AccountName &quot;myStorageAccount&quot;</dev:code>
124+
Get-AzureRmStorageAccount -ResourceGroupName &quot;rg1&quot; -AccountName &quot;mystorageaccount&quot;</dev:code>
125125
<dev:remarks>
126126
<maml:para />
127127
<maml:para />
@@ -304,7 +304,7 @@
304304
<maml:paragraph>PS C:\&gt;</maml:paragraph>
305305
</maml:introduction>
306306
<dev:code>#Get keys
307-
Get-AzureRmStorageAccountKey -ResourceGroupName &quot;RG1&quot; -AccountName &quot;myStorageAccount&quot;</dev:code>
307+
Get-AzureRmStorageAccountKey -ResourceGroupName &quot;rg1&quot; -AccountName &quot;mystorageaccount&quot;</dev:code>
308308
<dev:remarks>
309309
<maml:para />
310310
<maml:para />
@@ -375,6 +375,13 @@
375375
</maml:description>
376376
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
377377
</command:parameter>
378+
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="4">
379+
<maml:name>Tags</maml:name>
380+
<maml:description>
381+
<maml:para>Tags to set on the storage account.</maml:para>
382+
</maml:description>
383+
<command:parameterValue required="true" variableLength="true">Hashtable[]</command:parameterValue>
384+
</command:parameter>
378385
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
379386
<maml:name>Profile</maml:name>
380387
<maml:description>
@@ -437,6 +444,18 @@
437444
</dev:type>
438445
<dev:defaultValue></dev:defaultValue>
439446
</command:parameter>
447+
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="4">
448+
<maml:name>Tags</maml:name>
449+
<maml:description>
450+
<maml:para>Tags to set on the storage account.</maml:para>
451+
</maml:description>
452+
<command:parameterValue required="true" variableLength="true">Hashtable[]</command:parameterValue>
453+
<dev:type>
454+
<maml:name>Hashtable[]</maml:name>
455+
<maml:uri/>
456+
</dev:type>
457+
<dev:defaultValue></dev:defaultValue>
458+
</command:parameter>
440459
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
441460
<maml:name>Profile</maml:name>
442461
<maml:description>
@@ -490,7 +509,7 @@
490509
<maml:introduction>
491510
<maml:paragraph>PS C:\&gt;</maml:paragraph>
492511
</maml:introduction>
493-
<dev:code>New-AzureRmStorageAccount -ResourceGroupName &quot;myResourceGroup&quot; -AccountName &quot;myStorageAccount&quot; -Location &quot;US West&quot; -Type &quot;Standard_GRS&quot;</dev:code>
512+
<dev:code>New-AzureRmStorageAccount -ResourceGroupName &quot;myresourcegroup&quot; -AccountName &quot;mystorageaccount&quot; -Location &quot;US West&quot; -Type &quot;Standard_GRS&quot;</dev:code>
494513
<dev:remarks>
495514
<maml:para />
496515
<maml:para />
@@ -654,7 +673,7 @@
654673
<maml:paragraph>PS C:\&gt;</maml:paragraph>
655674
</maml:introduction>
656675
<dev:code>#Regenerate a key
657-
New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountName &quot;myStorageAccount&quot; -keyName &quot;key1&quot;</dev:code>
676+
New-AzureRmStorageKey -ResourceGroupName &quot;myresourcegroup&quot; -AccountName &quot;mystorageaccount&quot; -keyName &quot;key1&quot;</dev:code>
658677
<dev:remarks>
659678
<maml:para />
660679
<maml:para />
@@ -794,7 +813,7 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
794813
<maml:introduction>
795814
<maml:paragraph>PS C:\&gt;</maml:paragraph>
796815
</maml:introduction>
797-
<dev:code>PS C:\&gt; Remove-AzureRmStorageAccount -ResourceGroupName &quot;RG1&quot; -AccountName &quot;myStorageAccount&quot;</dev:code>
816+
<dev:code>PS C:\&gt; Remove-AzureRmStorageAccount -ResourceGroupName &quot;rg1&quot; -AccountName &quot;mystorageaccount&quot;</dev:code>
798817
<dev:remarks>
799818
<maml:para />
800819
<maml:para />
@@ -894,7 +913,7 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
894913
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="3">
895914
<maml:name>UseSubDomain</maml:name>
896915
<maml:description>
897-
<maml:para />
916+
<maml:para>Indicates whether indirect CName validation is enabled.</maml:para>
898917
</maml:description>
899918
<command:parameterValue required="true" variableLength="true">Nullable`1[Boolean]</command:parameterValue>
900919
</command:parameter>
@@ -925,7 +944,7 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
925944
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2">
926945
<maml:name>Tags</maml:name>
927946
<maml:description>
928-
<maml:para />
947+
<maml:para>Tags to set on the storage account.</maml:para>
929948
</maml:description>
930949
<command:parameterValue required="true" variableLength="true">Hashtable[]</command:parameterValue>
931950
</command:parameter>
@@ -1008,7 +1027,7 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
10081027
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="3">
10091028
<maml:name>UseSubDomain</maml:name>
10101029
<maml:description>
1011-
<maml:para />
1030+
<maml:para>Indicates whether indirect CName validation is enabled.</maml:para>
10121031
</maml:description>
10131032
<command:parameterValue required="true" variableLength="true">Nullable`1[Boolean]</command:parameterValue>
10141033
<dev:type>
@@ -1020,7 +1039,7 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
10201039
<command:parameter required="true" variableLength="true" globbing="false" pipelineInput="true (ByPropertyName)" position="2">
10211040
<maml:name>Tags</maml:name>
10221041
<maml:description>
1023-
<maml:para />
1042+
<maml:para>Tags to set on the storage account.</maml:para>
10241043
</maml:description>
10251044
<command:parameterValue required="true" variableLength="true">Hashtable[]</command:parameterValue>
10261045
<dev:type>
@@ -1029,18 +1048,6 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
10291048
</dev:type>
10301049
<dev:defaultValue></dev:defaultValue>
10311050
</command:parameter>
1032-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="true (ByValue, ByPropertyName)" position="3">
1033-
<maml:name>UseSubDomainName</maml:name>
1034-
<maml:description>
1035-
<maml:para />
1036-
</maml:description>
1037-
<command:parameterValue required="true" variableLength="false">nullable`1[boolean]</command:parameterValue>
1038-
<dev:type>
1039-
<maml:name>nullable`1[boolean]</maml:name>
1040-
<maml:uri/>
1041-
</dev:type>
1042-
<dev:defaultValue></dev:defaultValue>
1043-
</command:parameter>
10441051
</command:parameters>
10451052
<command:inputTypes>
10461053
<command:inputType>
@@ -1083,7 +1090,7 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
10831090
<maml:paragraph>PS C:\&gt;</maml:paragraph>
10841091
</maml:introduction>
10851092
<dev:code>PS C:\&gt; # Set account type
1086-
Set-AzureRmStorageAccount -ResourceGroupName &quot;myResourceGroup&quot; -AccountName &quot;myStorageAccount&quot; -Type &quot;Standard_RAGRS&quot;</dev:code>
1093+
Set-AzureRmStorageAccount -ResourceGroupName &quot;myresourcegroup&quot; -AccountName &quot;mystorageaccount&quot; -Type &quot;Standard_RAGRS&quot;</dev:code>
10871094
<dev:remarks>
10881095
<maml:para />
10891096
<maml:para />
@@ -1104,7 +1111,7 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
11041111
<maml:paragraph>PS C:\&gt;</maml:paragraph>
11051112
</maml:introduction>
11061113
<dev:code>PS C:\&gt; #Set custom domain
1107-
Set-AzureRmStorageAccount -ResourceGroupName &quot;myResourceGroup&quot; -AccountName &quot;myStorageAccount&quot; -CustomDomainName &quot;domain name&quot; –UseSubDomain true</dev:code>
1114+
Set-AzureRmStorageAccount -ResourceGroupName &quot;myresourcegroup&quot; -AccountName &quot;mystorageaccount&quot; -CustomDomainName &quot;www.domainname.com&quot; –UseSubDomain $true</dev:code>
11081115
<dev:remarks>
11091116
<maml:para />
11101117
<maml:para />
@@ -1123,4 +1130,4 @@ New-AzureRmStorageKey -ResourceGroupName &quot;myResourceGroup&quot; -AccountNam
11231130
<maml:relatedLinks>
11241131
</maml:relatedLinks>
11251132
</command:command>
1126-
</helpItems>
1133+
</helpItems>

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/NewAzureStorageAccount.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System.Collections;
1516
using System.Management.Automation;
17+
using Microsoft.Azure.Commands.Tags.Model;
1618
using Microsoft.Azure.Management.Storage;
1719
using Microsoft.Azure.Management.Storage.Models;
1820

@@ -60,14 +62,23 @@ public class NewAzureStorageAccountCommand : StorageAccountBaseCmdlet
6062
[ValidateNotNullOrEmpty]
6163
public string Location { get; set; }
6264

65+
[Parameter(
66+
Position = 4,
67+
Mandatory = false,
68+
ValueFromPipelineByPropertyName = true,
69+
HelpMessage = "Storage Account Tags.")]
70+
[ValidateNotNull]
71+
public Hashtable[] Tags { get; set; }
72+
6373
protected override void ProcessRecord()
6474
{
6575
base.ProcessRecord();
6676

6777
StorageAccountCreateParameters createParameters = new StorageAccountCreateParameters()
6878
{
6979
Location = this.Location,
70-
AccountType = ParseAccountType(this.Type)
80+
AccountType = ParseAccountType(this.Type),
81+
Tags = TagsConversionHelper.CreateTagDictionary(Tags, validate: true)
7182
};
7283

7384
var createAccountResponse = this.StorageClient.StorageAccounts.Create(

src/ResourceManager/Storage/Commands.Management.Storage/StorageAccount/SetAzureStorageAccount.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public class SetAzureStorageAccountCommand : StorageAccountBaseCmdlet
6969
ParameterSetName = UpdateCustomDomainParamSet,
7070
ValueFromPipelineByPropertyName = true,
7171
HelpMessage = "Storage Account Custom Domain Name.")]
72-
[ValidateNotNullOrEmpty]
72+
[AllowEmptyString]
73+
[ValidateNotNull]
7374
public string CustomDomainName { get; set; }
7475

7576
[Parameter(
@@ -86,7 +87,8 @@ public class SetAzureStorageAccountCommand : StorageAccountBaseCmdlet
8687
ParameterSetName = UpdateTagsParamSet,
8788
ValueFromPipelineByPropertyName = true,
8889
HelpMessage = "Storage Account Tags.")]
89-
[ValidateNotNullOrEmpty]
90+
[AllowEmptyCollection]
91+
[ValidateNotNull]
9092
public Hashtable[] Tags { get; set; }
9193

9294
protected override void ProcessRecord()
@@ -120,7 +122,7 @@ protected override void ProcessRecord()
120122

121123
updateParameters = new StorageAccountUpdateParameters
122124
{
123-
Tags = tagDictionary
125+
Tags = tagDictionary ?? new Dictionary<string, string>()
124126
};
125127
}
126128

src/ServiceManagement/Common/Commands.ScenarioTest/Resources/DscExtension/DscExtensionTests.ps1

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ function Test-GetAzureVMDscExtension
1111
Set-StrictMode -Version latest; $ErrorActionPreference = 'Stop'
1212

1313
# Publish DSC Configuration
14-
$configPath = '.\Resources\DscExtension\DummyConfig.ps1'
15-
$StorageAccountName = "dscextensiontest"
14+
# Publish doesnt work on some CI build machines (Still running WMF 4)
15+
#$configPath = '.\Resources\DscExtension\DummyConfig.ps1'
16+
#$StorageAccountName = "dscextensiontest"
1617

17-
$StorageAccountKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName
18-
$Ctx = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey.Primary
19-
Publish-AzureVMDscConfiguration -ConfigurationPath $configPath -StorageContext $Ctx -Force -Verbose
18+
#$StorageAccountKey = Get-AzureStorageKey -StorageAccountName $StorageAccountName
19+
#$Ctx = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $StorageAccountKey.Primary
20+
#Publish-AzureVMDscConfiguration -ConfigurationPath $configPath -StorageContext $Ctx -Force -Verbose
2021

2122
# Setup
2223
$location = Get-DefaultLocation
@@ -38,7 +39,9 @@ function Test-GetAzureVMDscExtension
3839
$vm = Get-AzureVM -ServiceName $svcName -Name $vmName
3940

4041
# Install DSC Extension Handler
41-
$vm = Set-AzureVMDSCExtension -VM $vm -ConfigurationArchive 'DummyConfig.ps1.zip' -ConfigurationName 'DummyConfig' -Verbose
42+
$version = '2.3'
43+
#$vm = Set-AzureVMDSCExtension -VM $vm -ConfigurationArchive 'DummyConfig.ps1.zip' -ConfigurationName 'DummyConfig' -Verbose
44+
$vm = Set-AzureVMDSCExtension -VM $vm -ConfigurationArchive '' -Version $version -Verbose
4245
$vm | Update-AzureVM -Verbose
4346

4447
# Call Get-AzureVMDscExtensionStatus to check the status of the installation
@@ -72,8 +75,6 @@ function Test-GetAzureVMDscExtension
7275
Assert-NotNull $extension.ExtensionName
7376
Assert-NotNull $extension.Publisher
7477
Assert-NotNull $extension.Version
75-
Assert-NotNull $extension.ModulesUrl
76-
Assert-NotNull $extension.ConfigurationFunction
7778

7879
# Remove Extension
7980
Remove-AzureVMDscExtension -VM $vm -Verbose

src/ServiceManagement/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.DscExtensionTests/TestGetAzureVMDscExtension.json

Lines changed: 5078 additions & 1206 deletions
Large diffs are not rendered by default.

src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/Extensions/DSC/GetAzureVMDscExtension.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ private void ExecuteCommand()
9393
{
9494
context.ModulesUrl = extensionPublicSettings.ModulesUrl;
9595
context.ConfigurationFunction = extensionPublicSettings.ConfigurationFunction;
96-
context.Properties = new Hashtable(extensionPublicSettings.Properties.ToDictionary( x => x.Name, x => x.Value ));
96+
if (extensionPublicSettings.Properties != null)
97+
{
98+
context.Properties =
99+
new Hashtable(extensionPublicSettings.Properties.ToDictionary(x => x.Name, x => x.Value));
100+
}
97101
}
98102

99103
return context;

0 commit comments

Comments
 (0)