Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compute/Compute.Test/Compute.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.1.0" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.21.1-preview" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1501,12 +1501,12 @@ function Test-VirtualMachineScaleSetPriority
$extname2 = 'csetest2';

$ipCfg = New-AzVmssIPConfig -Name 'test' -SubnetId $subnetId;
$vmss = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName 'Standard_A1' -UpgradePolicyMode 'Manual' -Priority 'Low' -EvictionPolicy 'Delete' `
$vmss = New-AzVmssConfig -Location $loc -SkuCapacity 2 -SkuName 'Standard_DS2_v2' -UpgradePolicyMode 'Manual' -Priority 'Low' -EvictionPolicy 'Delete' `
| Add-AzVmssNetworkInterfaceConfiguration -Name 'test' -Primary $true -IPConfiguration $ipCfg `
| Set-AzVmssOSProfile -ComputerNamePrefix 'test' -AdminUsername $adminUsername -AdminPassword $adminPassword `
| Set-AzVmssStorageProfile -Name 'test' -OsDiskCreateOption 'FromImage' -OsDiskCaching 'None' `
| Set-AzVmssStorageProfile -OsDiskCreateOption 'FromImage' -OsDiskCaching 'None' `
-ImageReferenceOffer $imgRef.Offer -ImageReferenceSku $imgRef.Skus -ImageReferenceVersion $imgRef.Version `
-ImageReferencePublisher $imgRef.PublisherName -VhdContainer $vhdContainer `
-ImageReferencePublisher $imgRef.PublisherName `
| Add-AzVmssExtension -Name $extname -Publisher $publisher -Type $exttype -TypeHandlerVersion $extver -AutoUpgradeMinorVersion $true;

$result = New-AzVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmss;
Expand All @@ -1522,6 +1522,20 @@ function Test-VirtualMachineScaleSetPriority
Assert-AreEqual "Low" $vmssResult.VirtualMachineProfile.Priority;
Assert-AreEqual "Delete" $vmssResult.VirtualMachineProfile.EvictionPolicy;

$vmssVMs = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName
$id = $vmssVMs[0].InstanceId

Set-AzVmssVM -ResourceGroupName $rgname -Name $vmssName -InstanceId $id -SimulateEviction;
$vmssResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;
Assert-AreEqual "Low" $vmssResult.VirtualMachineProfile.Priority;
Assert-AreEqual "Delete" $vmssResult.VirtualMachineProfile.EvictionPolicy;

$vmssInstanceViewResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
Assert-AreEqual "ProvisioningState/succeeded" $vmssInstanceViewResult.VirtualMachine.StatusesSummary[0].Code;

$vmssvmResult = Get-AzVmssVM -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceId $id;
Assert-AreEqual "Succeeded" $vmssvmResult.ProvisioningState;

$vmssResult.VirtualMachineProfile.Priority = "Regular";
Assert-ThrowsContains { Update-AzVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmssResult; } `
"Changing property 'priority' is not allowed";
Expand Down
12 changes: 9 additions & 3 deletions src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3831,15 +3831,21 @@ function Test-LowPriorityVirtualMachine
Assert-AreEqual "Deallocate" $vm.EvictionPolicy;
Assert-AreEqual 0.1538 $vm.BillingProfile.MaxPrice;
$vmstate = Get-AzVM -ResourceGroupName $rgname -Name $vmname -Status;
Assert-AreEqual "PowerState/running" $vmstate.Statuses[1].Code;

# Update the max price of the VM
Update-AzVM -ResourceGroupName $rgname -VM $vm -MaxPrice 0.2
Set-AzVM -ResourceGroupName $rgname -Name $vmname -SimulateEviction;

$vm = Get-AzVM -ResourceGroupName $rgname -Name $vmname;
Assert-AreEqual "Low" $vm.Priority;
Assert-AreEqual "Deallocate" $vm.EvictionPolicy;
Assert-AreEqual 0.2 $vm.BillingProfile.MaxPrice;
Assert-AreEqual 0.1538 $vm.BillingProfile.MaxPrice;

$vmstate = Get-AzVM -ResourceGroupName $rgname -Name $vmname -Status;
Assert-AreEqual "PowerState/running" $vmstate.Statuses[1].Code;

# Update the max price of the VM
Assert-ThrowsContains { Update-AzVM -ResourceGroupName $rgname -VM $vm -MaxPrice 0.2; } `
"Max price change is not allowed.";
}
finally
{
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
- Additional information about change #1
-->
## Upcoming Release
* Added SimulateEviction parameter to Set-AzVM and Set-AzVmssVM cmdlets.
* Added 'Premium_LRS' to the argument completer of StorageAccountType parameter for New-AzGalleryImageVersion cmdlet.
* Added 'Delete' to the argument completer of EvictionPolicy parameter for New-AzVM and New-AzVMConfig cmdlets.
* Fixed name of new VM Extension for SAP

Expand Down
2 changes: 1 addition & 1 deletion src/Compute/Compute/Compute.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.1.0" />
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.1" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public override void ExecuteCmdlet()
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true)]
[PSArgumentCompleter("Standard_LRS", "Standard_ZRS")]
[PSArgumentCompleter("Standard_LRS", "Standard_ZRS", "Premium_LRS")]
public string StorageAccountType { get; set; }

[Parameter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public override void ExecuteCmdlet()
{
result = VirtualMachineScaleSetVMsClient.PerformMaintenanceWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult();
}
else if (this.ParameterSetName.Equals("SimulateEvictionMethodParameter"))
{
result = VirtualMachineScaleSetVMsClient.SimulateEvictionWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult();
}
else
{
result = VirtualMachineScaleSetVMsClient.ReimageWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceId).GetAwaiter().GetResult();
Expand Down Expand Up @@ -122,6 +126,11 @@ public override void ExecuteCmdlet()
Mandatory = true)]
public SwitchParameter PerformMaintenance { get; set; }

[Parameter(
ParameterSetName = "SimulateEvictionMethodParameter",
Mandatory = true)]
public SwitchParameter SimulateEviction { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }
}
Expand Down
43 changes: 43 additions & 0 deletions src/Compute/Compute/VirtualMachine/Action/SetAzureVMCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ public class SetAzureVMCommand : VirtualMachineBaseCmdlet
protected const string GeneralizeResourceGroupNameParameterSet = "GeneralizeResourceGroupNameParameterSetName";
protected const string RedeployResourceGroupNameParameterSet = "RedeployResourceGroupNameParameterSetName";
protected const string ReapplyResourceGroupNameParameterSet = "ReapplyResourceGroupNameParameterSetName";
protected const string SimulateEvictionResourceGroupNameParameterSet = "SimulateEvictionResourceGroupNameParameterSetName";
protected const string GeneralizeIdParameterSet = "GeneralizeIdParameterSetName";
protected const string RedeployIdParameterSet = "RedeployIdParameterSetName";
protected const string ReapplyIdParameterSet = "ReapplyIdParameterSetName";
protected const string SimulateEvictionIdParameterSet = "SimulateEvictionIdParameterSetName";

[Parameter(
Mandatory = true,
Expand All @@ -49,6 +51,12 @@ public class SetAzureVMCommand : VirtualMachineBaseCmdlet
ParameterSetName = ReapplyResourceGroupNameParameterSet,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name.")]
[Parameter(
Mandatory = true,
Position = 0,
ParameterSetName = SimulateEvictionResourceGroupNameParameterSet,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name.")]
[ResourceGroupCompleter]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }
Expand All @@ -71,6 +79,12 @@ public class SetAzureVMCommand : VirtualMachineBaseCmdlet
ParameterSetName = ReapplyIdParameterSet,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource ID.")]
[Parameter(
Mandatory = true,
Position = 0,
ParameterSetName = SimulateEvictionIdParameterSet,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource ID.")]
[ValidateNotNullOrEmpty]
[ResourceIdCompleter("Microsoft.Compute/virtualMachines")]
public string Id { get; set; }
Expand All @@ -93,6 +107,12 @@ public class SetAzureVMCommand : VirtualMachineBaseCmdlet
ParameterSetName = ReapplyResourceGroupNameParameterSet,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The virtual machine name.")]
[Parameter(
Mandatory = true,
Position = 1,
ParameterSetName = SimulateEvictionResourceGroupNameParameterSet,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The virtual machine name.")]
[ResourceNameCompleter("Microsoft.Compute/virtualMachines", "ResourceGroupName")]
[ValidateNotNullOrEmpty]
public string Name { get; set; }
Expand Down Expand Up @@ -129,6 +149,16 @@ public class SetAzureVMCommand : VirtualMachineBaseCmdlet
HelpMessage = "To reapply virtual machine.")]
public SwitchParameter Reapply { get; set; }

[Parameter(
Mandatory = true,
ParameterSetName = SimulateEvictionResourceGroupNameParameterSet,
HelpMessage = "To simulate eviction of virtual machine.")]
[Parameter(
Mandatory = true,
ParameterSetName = SimulateEvictionIdParameterSet,
HelpMessage = "To simulate eviction of virtual machine.")]
public SwitchParameter SimulateEviction { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

Expand Down Expand Up @@ -178,6 +208,19 @@ public override void ExecuteCmdlet()
WriteObject(result);
});
}
else if (this.SimulateEviction.IsPresent)
{
ExecuteClientAction(() =>
{
var op = this.VirtualMachineClient.SimulateEvictionWithHttpMessagesAsync(
this.ResourceGroupName,
this.Name).GetAwaiter().GetResult();
var result = ComputeAutoMapperProfile.Mapper.Map<PSComputeLongRunningOperation>(op);
result.StartTime = this.StartTime;
result.EndTime = DateTime.Now;
WriteObject(result);
});
}
else if (this.Redeploy.IsPresent)
{
ExecuteClientAction(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/Compute/Compute/help/New-AzGalleryImageVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Accept wildcard characters: False
```

### -StorageAccountType
Specifies the storage account type to be used to store the image. This property is not updatable. Available values are Standard_LRS and Standard_ZRS.
Specifies the storage account type to be used to store the image. This property is not updatable. Available values are Standard_LRS, Standard_ZRS and Premium_LRS.

```yaml
Type: System.String
Expand Down
34 changes: 31 additions & 3 deletions src/Compute/Compute/help/Set-AzVM.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Set-AzVM [-ResourceGroupName] <String> [-Name] <String> [-Reapply] [-AsJob] [-No
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

### SimulateEvictionResourceGroupNameParameterSetName
```
Set-AzVM [-ResourceGroupName] <String> [-Name] <String> [-SimulateEviction] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

### GeneralizeIdParameterSetName
```
Set-AzVM [-Id] <String> [-Generalized] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Expand All @@ -48,6 +54,12 @@ Set-AzVM [-Id] <String> [-Reapply] [-AsJob] [-NoWait] [-DefaultProfile <IAzureCo
[<CommonParameters>]
```

### SimulateEvictionIdParameterSetName
```
Set-AzVM [-Id] <String> [-SimulateEviction] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
```

## DESCRIPTION
The **Set-AzVM** cmdlet marks a virtual machine as generalized.
Before you run this cmdlet, log on to the virtual machine and use Sysprep to prepare the hard disk.
Expand Down Expand Up @@ -113,7 +125,7 @@ Specifies the Resource ID of the virtual machine.

```yaml
Type: System.String
Parameter Sets: GeneralizeIdParameterSetName, RedeployIdParameterSetName, ReapplyIdParameterSetName
Parameter Sets: GeneralizeIdParameterSetName, RedeployIdParameterSetName, ReapplyIdParameterSetName, SimulateEvictionIdParameterSetName
Aliases:

Required: True
Expand All @@ -128,7 +140,7 @@ Specifies the name of the virtual machine on which this cmdlet operates.

```yaml
Type: System.String
Parameter Sets: GeneralizeResourceGroupNameParameterSetName, RedeployResourceGroupNameParameterSetName, ReapplyResourceGroupNameParameterSetName
Parameter Sets: GeneralizeResourceGroupNameParameterSetName, RedeployResourceGroupNameParameterSetName, ReapplyResourceGroupNameParameterSetName, SimulateEvictionResourceGroupNameParameterSetName
Aliases:

Required: True
Expand Down Expand Up @@ -189,7 +201,7 @@ Specifies the name of the resource group of the virtual machine.

```yaml
Type: System.String
Parameter Sets: GeneralizeResourceGroupNameParameterSetName, RedeployResourceGroupNameParameterSetName, ReapplyResourceGroupNameParameterSetName
Parameter Sets: GeneralizeResourceGroupNameParameterSetName, RedeployResourceGroupNameParameterSetName, ReapplyResourceGroupNameParameterSetName, SimulateEvictionResourceGroupNameParameterSetName
Aliases:

Required: True
Expand All @@ -199,6 +211,22 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -SimulateEviction
Indicates that this cmdlet simulates the eviction of spot virtual machine.
The eviction will occur within 30 minutes of calling the API.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: SimulateEvictionResourceGroupNameParameterSetName, SimulateEvictionIdParameterSetName
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

Expand Down
23 changes: 23 additions & 0 deletions src/Compute/Compute/help/Set-AzVmssVM.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ Set-AzVmssVM [-ResourceGroupName] <String> [-VMScaleSetName] <String> [-Instance
[<CommonParameters>]
```

### SimulateEvictionMethodParameter
```
Set-AzVmssVM [-ResourceGroupName] <String> [-VMScaleSetName] <String> [-InstanceId] <String>
[-SimulateEviction] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION
The **Set-AzVmssVM** cmdlet modifies the state of a Virtual Machine Scale Set (VMSS) instance.

Expand Down Expand Up @@ -165,6 +172,22 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -SimulateEviction
Indicates that this cmdlet simulates the eviction of spot virtual machine in a VM scale set.
The eviction will occur within 30 minutes of calling the API.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: SimulateEvictionMethodParameter
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -VMScaleSetName
Specifies the name of the VMSS instance that this cmdlet modifies.

Expand Down
2 changes: 1 addition & 1 deletion src/Network/Network.Test/Network.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<PackageReference Include="Microsoft.Azure.Graph.RBAC" Version="3.4.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.21.1-preview" />
<PackageReference Include="Microsoft.Azure.Insights" Version="0.16.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.1.0" />
<PackageReference Include="Microsoft.Azure.Management.ContainerInstance" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.21.0-preview" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.21.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.0.1-preview" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.21.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="14.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="36.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.21.1-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="13.1.0" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="3.7.1-preview" />
Expand Down