Skip to content

Commit 5c8264b

Browse files
author
Maddie Clayton
authored
Merge branch 'master' into fixhelp1
2 parents 5293cf5 + 9fff852 commit 5c8264b

File tree

118 files changed

+6092
-3183
lines changed

Some content is hidden

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

118 files changed

+6092
-3183
lines changed

src/Automation/Automation/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
-->
2020
## Upcoming Release
2121
* Update help for Import-AzAutomationDscNodeConfiguration
22+
* Added configuration name validation to Import-AzAutomationDscConfiguration cmdlet
23+
* Improved error handling for Import-AzAutomationDscConfiguration cmdlet
2224

2325
## Version 1.1.0
2426
* Added support for Python 2 runbooks

src/Automation/Automation/Common/AutomationPSClientDSC.cs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,11 @@ public Model.DscConfiguration CreateConfiguration(
173173
string fileContent = null;
174174
string configurationName = String.Empty;
175175

176-
try
176+
if (File.Exists(Path.GetFullPath(sourcePath)))
177177
{
178-
if (File.Exists(Path.GetFullPath(sourcePath)))
179-
{
180-
fileContent = System.IO.File.ReadAllText(sourcePath);
181-
}
178+
fileContent = System.IO.File.ReadAllText(sourcePath);
182179
}
183-
catch (Exception)
184-
{
180+
else {
185181
// exception in accessing the file path
186182
throw new FileNotFoundException(
187183
string.Format(
@@ -192,6 +188,10 @@ public Model.DscConfiguration CreateConfiguration(
192188
// configuration name is same as filename
193189
configurationName = Path.GetFileNameWithoutExtension(sourcePath);
194190

191+
if (!System.Text.RegularExpressions.Regex.IsMatch(configurationName, "^([a-zA-Z]{1}([a-zA-Z0-9]|_){0,63})$")) {
192+
throw new PSInvalidOperationException("Invalid configuration name. Valid configuration names can contain only letters, numbers, and underscores. The name must start with a letter. The length of the name must be between 1 and 64 characters. ");
193+
}
194+
195195
// for the private preview, configuration can be imported in Published mode only
196196
// Draft mode is not implemented
197197
if (!published)
@@ -238,14 +238,30 @@ public Model.DscConfiguration CreateConfiguration(
238238
}
239239
};
240240

241-
var configuration =
242-
this.automationManagementClient.DscConfiguration.CreateOrUpdate(
241+
try
242+
{
243+
var configuration =
244+
this.automationManagementClient.DscConfiguration.CreateOrUpdate(
243245
resourceGroupName,
244246
automationAccountName,
245247
configurationName,
246248
configurationCreateParameters);
247249

248-
return new Model.DscConfiguration(resourceGroupName, automationAccountName, configuration);
250+
return new Model.DscConfiguration(resourceGroupName, automationAccountName, configuration);
251+
}
252+
catch (Microsoft.Azure.Management.Automation.Models.ErrorResponseException ex)
253+
{
254+
if (ex.Response.Content != null)
255+
{
256+
throw new Microsoft.Azure.Management.Automation.Models.ErrorResponseException(ex.Response.Content, ex);
257+
}
258+
else {
259+
throw ex;
260+
}
261+
}
262+
catch (Exception ex) {
263+
throw ex;
264+
}
249265
}
250266
}
251267

src/Compute/Compute.Test/ScenarioTests/ImageTests.ps1

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,10 @@ function Test-Image
129129
Assert-AreEqual 1 $images.Count;
130130

131131
# Update Image Tag
132-
$image = Get-AzImage -ResourceGroupName $rgname -ImageName $imageName;
133-
$image.Tags = New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]";
134-
$image.Tags.Add("test1", "testval3");
135-
$image.Tags.Add("test2", "testval4");
136-
Update-AzImage -ResourceGroupName $rgname -ImageName $imageName -Image $image;
132+
$images[0] | Update-AzImage -Tag @{test1 = "testval3"; test2 = "testval4"};
133+
Update-AzImage -ResourceGroupName $rgname -ImageName $imageName -Tag @{test1 = "testval3"; test2 = "testval4"};
134+
Update-AzImage -Image $images[0] -Tag @{test1 = "testval3"; test2 = "testval4"};
135+
Update-AzImage -ResourceId $images[0].Id -Tag @{test1 = "testval3"; test2 = "testval4"};
137136

138137
$image = Get-AzImage -ResourceGroupName $rgname -ImageName $imageName;
139138
Assert-True {$image.Tags.ContainsKey("test1") }
@@ -215,7 +214,7 @@ function Test-ImageCapture
215214
$p = Add-AzVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 2 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
216215
$p = Add-AzVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 3 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
217216
$p = Remove-AzVMDataDisk -VM $p -Name 'testDataDisk3';
218-
217+
219218
# OS & Image
220219
$user = "Foo12";
221220
$password = $PLACEHOLDER;

src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,11 +2083,19 @@ function Test-VirtualMachineScaleSetAutoRollback
20832083
Assert-AreEqual 2 $vmss.Sku.Capacity;
20842084
Assert-AreEqual $false $vmss.VirtualMachineProfile.StorageProfile.OsDisk.WriteAcceleratorEnabled;
20852085

2086+
$vmssVMsStatus = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
2087+
$vmssVMsStatusFullOutput = $vmssVMsStatus | fc | Out-String;
2088+
Assert-True { $vmssVMsStatusFullOutput.Contains("InstanceView") };
2089+
20862090
$vmss2 = $vmss | Update-AzVmss -DisableAutoRollback $true;
20872091
Assert-True { $vmss2.UpgradePolicy.AutomaticOSUpgradePolicy.DisableAutomaticRollback };
20882092

20892093
$result = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -OSUpgradeHistory;
20902094
Assert-Null $result
2095+
2096+
$vmssVMsStatus = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
2097+
$vmssVMsStatusFullOutput = $vmssVMsStatus | fc | Out-String;
2098+
Assert-True { $vmssVMsStatusFullOutput.Contains("InstanceView") };
20912099
}
20922100
finally
20932101
{

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.ImageTests/TestImage.json

Lines changed: 1331 additions & 719 deletions
Large diffs are not rendered by default.

src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.VirtualMachineScaleSetTests/TestVirtualMachineScaleSetAutoRollback.json

Lines changed: 1167 additions & 2098 deletions
Large diffs are not rendered by default.

src/Compute/Compute/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
- Additional information about change #1
2020
-->
2121
## Upcoming Release
22+
* Add Tag and ResourceId parameters to Update-AzImage cmdlet
23+
* Get-AzVmssVM without instance ID and with InstanceView can list VMSS VMs with instance view.
2224

2325
## Version 1.3.0
2426
* AEM extension: Add support for UltraSSD and P60,P70 and P80 disks

src/Compute/Compute/Generated/ContainerService/ContainerServiceCreateOrUpdateMethod.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ public override void ExecuteCmdlet()
5757

5858
[Parameter(
5959
ParameterSetName = "DefaultParameter",
60-
Position = 1,
60+
Position = 0,
6161
Mandatory = true,
6262
ValueFromPipelineByPropertyName = true)]
6363
[ResourceGroupCompleter]
6464
public string ResourceGroupName { get; set; }
6565

6666
[Parameter(
6767
ParameterSetName = "DefaultParameter",
68-
Position = 2,
68+
Position = 1,
6969
Mandatory = true,
7070
ValueFromPipelineByPropertyName = true)]
7171
public string Name { get; set; }
7272

7373
[Parameter(
7474
ParameterSetName = "DefaultParameter",
75-
Position = 3,
75+
Position = 2,
7676
Mandatory = true,
7777
ValueFromPipeline = true)]
7878
public PSContainerService ContainerService { get; set; }
@@ -107,22 +107,22 @@ public override void ExecuteCmdlet()
107107

108108
[Parameter(
109109
ParameterSetName = "DefaultParameter",
110-
Position = 1,
110+
Position = 0,
111111
Mandatory = true,
112112
ValueFromPipelineByPropertyName = true)]
113113
[ResourceGroupCompleter]
114114
public string ResourceGroupName { get; set; }
115115

116116
[Parameter(
117117
ParameterSetName = "DefaultParameter",
118-
Position = 2,
118+
Position = 1,
119119
Mandatory = true,
120120
ValueFromPipelineByPropertyName = true)]
121121
public string Name { get; set; }
122122

123123
[Parameter(
124124
ParameterSetName = "DefaultParameter",
125-
Position = 3,
125+
Position = 2,
126126
Mandatory = true,
127127
ValueFromPipeline = true)]
128128
public PSContainerService ContainerService { get; set; }

src/Compute/Compute/Generated/ContainerService/ContainerServiceDeleteMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public override void ExecuteCmdlet()
6767

6868
[Parameter(
6969
ParameterSetName = "DefaultParameter",
70-
Position = 1,
70+
Position = 0,
7171
Mandatory = true,
7272
ValueFromPipelineByPropertyName = true)]
7373
[ResourceGroupCompleter]
7474
public string ResourceGroupName { get; set; }
7575

7676
[Parameter(
7777
ParameterSetName = "DefaultParameter",
78-
Position = 2,
78+
Position = 1,
7979
Mandatory = true,
8080
ValueFromPipelineByPropertyName = true)]
8181
[ResourceNameCompleter("Microsoft.ContainerService/containerServices", "ResourceGroupName")]

src/Compute/Compute/Generated/ContainerService/ContainerServiceGetMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ public override void ExecuteCmdlet()
9797

9898
[Parameter(
9999
ParameterSetName = "DefaultParameter",
100-
Position = 1,
100+
Position = 0,
101101
ValueFromPipelineByPropertyName = true)]
102102
[ResourceGroupCompleter]
103103
public string ResourceGroupName { get; set; }
104104

105105
[Parameter(
106106
ParameterSetName = "DefaultParameter",
107-
Position = 2,
107+
Position = 1,
108108
ValueFromPipelineByPropertyName = true)]
109109
[ResourceNameCompleter("Microsoft.ContainerService/containerServices", "ResourceGroupName")]
110110
public string Name { get; set; }

src/Compute/Compute/Generated/Disk/DiskCreateOrUpdateMethod.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,23 @@ public override void ExecuteCmdlet()
5757

5858
[Parameter(
5959
ParameterSetName = "DefaultParameter",
60-
Position = 1,
60+
Position = 0,
6161
Mandatory = true,
6262
ValueFromPipelineByPropertyName = true)]
6363
[ResourceGroupCompleter]
6464
public string ResourceGroupName { get; set; }
6565

6666
[Parameter(
6767
ParameterSetName = "DefaultParameter",
68-
Position = 2,
68+
Position = 1,
6969
Mandatory = true,
7070
ValueFromPipelineByPropertyName = true)]
7171
[Alias("Name")]
7272
public string DiskName { get; set; }
7373

7474
[Parameter(
7575
ParameterSetName = "DefaultParameter",
76-
Position = 3,
76+
Position = 2,
7777
Mandatory = true,
7878
ValueFromPipeline = true)]
7979
public PSDisk Disk { get; set; }

src/Compute/Compute/Generated/Disk/DiskDeleteMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ public override void ExecuteCmdlet()
6767

6868
[Parameter(
6969
ParameterSetName = "DefaultParameter",
70-
Position = 1,
70+
Position = 0,
7171
Mandatory = true,
7272
ValueFromPipelineByPropertyName = true)]
7373
[ResourceGroupCompleter]
7474
public string ResourceGroupName { get; set; }
7575

7676
[Parameter(
7777
ParameterSetName = "DefaultParameter",
78-
Position = 2,
78+
Position = 1,
7979
Mandatory = true,
8080
ValueFromPipelineByPropertyName = true)]
8181
[ResourceNameCompleter("Microsoft.Compute/disks", "ResourceGroupName")]

src/Compute/Compute/Generated/Disk/DiskGetMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ public override void ExecuteCmdlet()
9797

9898
[Parameter(
9999
ParameterSetName = "DefaultParameter",
100-
Position = 1,
100+
Position = 0,
101101
ValueFromPipelineByPropertyName = true)]
102102
[ResourceGroupCompleter]
103103
public string ResourceGroupName { get; set; }
104104

105105
[Parameter(
106106
ParameterSetName = "DefaultParameter",
107-
Position = 2,
107+
Position = 1,
108108
ValueFromPipelineByPropertyName = true)]
109109
[ResourceNameCompleter("Microsoft.Compute/disks", "ResourceGroupName")]
110110
[Alias("Name")]

src/Compute/Compute/Generated/Disk/DiskGrantAccessMethod.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ public override void ExecuteCmdlet()
5858

5959
[Parameter(
6060
ParameterSetName = "DefaultParameter",
61-
Position = 1,
61+
Position = 0,
6262
Mandatory = true,
6363
ValueFromPipelineByPropertyName = true)]
6464
[ResourceGroupCompleter]
6565
public string ResourceGroupName { get; set; }
6666

6767
[Parameter(
6868
ParameterSetName = "DefaultParameter",
69-
Position = 2,
69+
Position = 1,
7070
Mandatory = true,
7171
ValueFromPipelineByPropertyName = true)]
7272
[ResourceNameCompleter("Microsoft.Compute/disks", "ResourceGroupName")]
@@ -75,13 +75,13 @@ public override void ExecuteCmdlet()
7575

7676
[Parameter(
7777
ParameterSetName = "DefaultParameter",
78-
Position = 3,
78+
Position = 2,
7979
Mandatory = true)]
8080
public string Access { get; set; }
8181

8282
[Parameter(
8383
ParameterSetName = "DefaultParameter",
84-
Position = 4,
84+
Position = 3,
8585
Mandatory = false)]
8686
public int DurationInSecond { get; set; }
8787

src/Compute/Compute/Generated/Disk/DiskRevokeAccessMethod.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ public override void ExecuteCmdlet()
6464

6565
[Parameter(
6666
ParameterSetName = "DefaultParameter",
67-
Position = 1,
67+
Position = 0,
6868
Mandatory = true,
6969
ValueFromPipelineByPropertyName = true)]
7070
[ResourceGroupCompleter]
7171
public string ResourceGroupName { get; set; }
7272

7373
[Parameter(
7474
ParameterSetName = "DefaultParameter",
75-
Position = 2,
75+
Position = 1,
7676
Mandatory = true,
7777
ValueFromPipelineByPropertyName = true)]
7878
[ResourceNameCompleter("Microsoft.Compute/disks", "ResourceGroupName")]

src/Compute/Compute/Generated/Disk/DiskUpdateMethod.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,25 @@ public override void ExecuteCmdlet()
6161

6262
[Parameter(
6363
ParameterSetName = "DefaultParameter",
64-
Position = 1,
64+
Position = 0,
6565
Mandatory = true,
6666
ValueFromPipelineByPropertyName = true)]
6767
[Parameter(
6868
ParameterSetName = "FriendMethod",
69-
Position = 1,
69+
Position = 0,
7070
Mandatory = true,
7171
ValueFromPipelineByPropertyName = true)]
7272
[ResourceGroupCompleter]
7373
public string ResourceGroupName { get; set; }
7474

7575
[Parameter(
7676
ParameterSetName = "DefaultParameter",
77-
Position = 2,
77+
Position = 1,
7878
Mandatory = true,
7979
ValueFromPipelineByPropertyName = true)]
8080
[Parameter(
8181
ParameterSetName = "FriendMethod",
82-
Position = 2,
82+
Position = 1,
8383
Mandatory = true,
8484
ValueFromPipelineByPropertyName = true)]
8585
[ResourceNameCompleter("Microsoft.Compute/disks", "ResourceGroupName")]
@@ -88,14 +88,14 @@ public override void ExecuteCmdlet()
8888

8989
[Parameter(
9090
ParameterSetName = "DefaultParameter",
91-
Position = 3,
91+
Position = 2,
9292
Mandatory = true,
9393
ValueFromPipeline = true)]
9494
public PSDiskUpdate DiskUpdate { get; set; }
9595

9696
[Parameter(
9797
ParameterSetName = "FriendMethod",
98-
Position = 4,
98+
Position = 2,
9999
Mandatory = true,
100100
ValueFromPipelineByPropertyName = false,
101101
ValueFromPipeline = true)]

src/Compute/Compute/Generated/Gallery/GalleryDeleteMethod.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public override void ExecuteCmdlet()
113113
Position = 0,
114114
Mandatory = true,
115115
ValueFromPipeline = true)]
116+
[ValidateNotNullOrEmpty]
116117
public PSGallery InputObject { get; set; }
117118

118119
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]

src/Compute/Compute/Generated/Gallery/GalleryGetMethod.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ public override void ExecuteCmdlet()
109109
[Parameter(
110110
ParameterSetName = "DefaultParameter",
111111
Position = 0,
112-
Mandatory = false,
113112
ValueFromPipelineByPropertyName = true)]
114113
[ResourceGroupCompleter]
115114
public string ResourceGroupName { get; set; }
@@ -118,7 +117,6 @@ public override void ExecuteCmdlet()
118117
[Parameter(
119118
ParameterSetName = "DefaultParameter",
120119
Position = 1,
121-
Mandatory = false,
122120
ValueFromPipelineByPropertyName = true)]
123121
public string Name { get; set; }
124122

0 commit comments

Comments
 (0)