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
5 changes: 3 additions & 2 deletions 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="33.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="35.1.0" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="2.4.2" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="19.19.0-preview" />
</ItemGroup>
Expand All @@ -31,4 +31,5 @@
<None Include="..\..\Resources\Resources.Test\ScenarioTests\Common.ps1" Link="ScenarioTests\Common.ps1" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
</Project>

Original file line number Diff line number Diff line change
Expand Up @@ -2322,9 +2322,27 @@ function Test-VirtualMachineScaleSetAutoRepair
New-AzVmss -ResourceGroupName $rgname -Name $vmssName -VirtualMachineScaleSet $vmss;

$vmssResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;
Assert-True { $vmssResult.AutomaticRepairsPolicy.Enabled };
Assert-AreEqual "PT10S" $vmssResult.AutomaticRepairsPolicy.GracePeriod;
$vmssInstanceViewResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
Assert-AreEqual "AutomaticRepairs" $vmssInstanceViewResult.OrchestrationServices[0].ServiceName;
Assert-AreEqual "Running" $vmssInstanceViewResult.OrchestrationServices[0].ServiceState;

Set-AzVmssOrchestrationServiceState -ResourceGroupName $rgname -VMScaleSetName $vmssName -ServiceName "AutomaticRepairs" -Action "Suspend";
$vmssResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;
Assert-True { $vmssResult.AutomaticRepairsPolicy.Enabled };
Assert-AreEqual "PT10S" $vmssResult.AutomaticRepairsPolicy.GracePeriod;
$vmssInstanceViewResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
Assert-AreEqual "AutomaticRepairs" $vmssInstanceViewResult.OrchestrationServices[0].ServiceName;
Assert-AreEqual "Suspended" $vmssInstanceViewResult.OrchestrationServices[0].ServiceState;

$vmssResult | Set-AzVmssOrchestrationServiceState -ServiceName "AutomaticRepairs" -Action "Resume";
$vmssResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName;
Assert-True { $vmssResult.AutomaticRepairsPolicy.Enabled };
Assert-AreEqual "PT10S" $vmssResult.AutomaticRepairsPolicy.GracePeriod;
$vmssInstanceViewResult = Get-AzVmss -ResourceGroupName $rgname -VMScaleSetName $vmssName -InstanceView;
Assert-AreEqual "AutomaticRepairs" $vmssInstanceViewResult.OrchestrationServices[0].ServiceName;
Assert-AreEqual "Running" $vmssInstanceViewResult.OrchestrationServices[0].ServiceState;

Update-AzVmss -ResourceGroupName $rgname -Name $vmssName -EnableAutomaticRepair $false;

Expand All @@ -2339,4 +2357,3 @@ function Test-VirtualMachineScaleSetAutoRepair
Clean-ResourceGroup $rgname
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -708,21 +708,14 @@ function Test-VirtualMachineImageList

$skusName = Get-ComputeTestResourceName;
Assert-ThrowsContains { $s4 = Get-AzVMImage -Location $locStr -PublisherName $publisherName -Offer $offerName -Skus $skusName; } "was not found";

$filter = "name eq 'latest'";
Assert-ThrowsContains { $s5 = Get-AzVMImage -Location $locStr -PublisherName $publisherName -Offer $offerName -Skus $skusName -FilterExpression $filter; } "was not found";

$version = '1.0.0';
Assert-ThrowsContains { $s6 = Get-AzVMImage -Location $locStr -PublisherName $publisherName -Offer $offerName -Skus $skusName -Version $version; } "was not found";

# Extension Images
$type = Get-ComputeTestResourceName;
Assert-ThrowsContains { $s7 = Get-AzVMExtensionImage -Location $locStr -PublisherName $publisherName -Type $type -FilterExpression $filter -Version $version; } "was not found";

Assert-ThrowsContains { $s8 = Get-AzVMExtensionImageType -Location $locStr -PublisherName $publisherName; } "was not found";

Assert-ThrowsContains { $s9 = Get-AzVMExtensionImage -Location $locStr -PublisherName $publisherName -Type $type -FilterExpression $filter; } "was not found";

$passed = $true;
}
finally
Expand Down

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions src/Compute/Compute.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2042
# Visual Studio Version 16
VisualStudioVersion = 16.0.29920.165
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compute", "Compute\Compute.csproj", "{52643BD5-6378-49BD-9F6E-DAC9DD8A867B}"
EndProject
Expand All @@ -14,8 +14,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Acc
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KeyVault", "..\KeyVault\KeyVault\KeyVault.csproj", "{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManagedServiceIdentity", "..\ManagedServiceIdentity\ManagedServiceIdentity.csproj", "{228EB071-FA04-43B3-95F9-7D76DBF0B850}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{3E016018-D65D-4336-9F64-17DA97783AD0}"
Expand Down Expand Up @@ -50,10 +48,6 @@ Global
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9FFC40CC-A341-4D0C-A25D-DC6B78EF6C94}.Release|Any CPU.Build.0 = Release|Any CPU
{228EB071-FA04-43B3-95F9-7D76DBF0B850}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{228EB071-FA04-43B3-95F9-7D76DBF0B850}.Debug|Any CPU.Build.0 = Debug|Any CPU
{228EB071-FA04-43B3-95F9-7D76DBF0B850}.Release|Any CPU.ActiveCfg = Release|Any CPU
{228EB071-FA04-43B3-95F9-7D76DBF0B850}.Release|Any CPU.Build.0 = Release|Any CPU
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF81DC73-B8EC-4082-8841-4FBF2B16E7CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
3 changes: 2 additions & 1 deletion src/Compute/Compute/Az.Compute.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ CmdletsToExport = 'Remove-AzAvailabilitySet', 'Get-AzAvailabilitySet',
'Get-AzHostGroup', 'Remove-AzHostGroup', 'New-AzHost', 'Get-AzHost',
'Remove-AzHost', 'New-AzDiskEncryptionSetConfig',
'New-AzDiskEncryptionSet', 'Get-AzDiskEncryptionSet',
'Remove-AzDiskEncryptionSet', 'Update-AzDiskEncryptionSet'
'Remove-AzDiskEncryptionSet', 'Update-AzDiskEncryptionSet',
'Set-AzVmssOrchestrationServiceState'

# Variables to export from this module
# VariablesToExport = @()
Expand Down
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 Set-AzVmssOrchestrationServiceState cmdlet.
* Get-AzVmss with -InstanceView shows OrchestrationService states.

## Version 3.6.0
* Added the following parameters to `New-AzDiskConfig` cmdlet:
Expand Down
6 changes: 3 additions & 3 deletions src/Compute/Compute/Compute.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PsModuleName>Compute</PsModuleName>
Expand All @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.2.2" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="33.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="35.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 All @@ -30,4 +30,4 @@
<Compile Include="$(StorageToolsPath)Adapters\WindowsAzure.Storage.6\AzureStorageContext.cs" Link="Common\AzureStorageContext.cs" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public partial class PSVirtualMachineScaleSetInstanceView
public VirtualMachineScaleSetInstanceViewStatusesSummary VirtualMachine { get; set; }
public IList<VirtualMachineScaleSetVMExtensionsSummary> Extensions { get; set; }
public IList<InstanceViewStatus> Statuses { get; set; }
public IList<OrchestrationServiceSummary> OrchestrationServices { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//

// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.WindowsAzure.Commands.Utilities.Common;

namespace Microsoft.Azure.Commands.Compute.Automation
{
[Cmdlet(VerbsCommon.Set, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "VmssOrchestrationServiceState", DefaultParameterSetName = "DefaultParameter", SupportsShouldProcess = true)]
[OutputType(typeof(PSOperationStatusResponse))]
public partial class SetAzureRmVmssOrchestrationServiceState : ComputeAutomationBaseCmdlet
{
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
ExecuteClientAction(() =>
{
if (ShouldProcess(this.VMScaleSetName, VerbsCommon.Set))
{
string resourceGroupName;
string vmScaleSetName;
switch (this.ParameterSetName)
{
case "ResourceIdParameter":
resourceGroupName = GetResourceGroupName(this.ResourceId);
vmScaleSetName = GetResourceName(this.ResourceId, "Microsoft.Compute/virtualMachineScaleSets");
break;
case "ObjectParameter":
resourceGroupName = GetResourceGroupName(this.InputObject.Id);
vmScaleSetName = GetResourceName(this.InputObject.Id, "Microsoft.Compute/virtualMachineScaleSets");
break;
default:
resourceGroupName = this.ResourceGroupName;
vmScaleSetName = this.VMScaleSetName;
break;
}

OrchestrationServiceStateInput parameters = new OrchestrationServiceStateInput();
parameters.ServiceName = this.ServiceName;
parameters.Action = this.Action;

var result = VirtualMachineScaleSetsClient.SetOrchestrationServiceStateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, parameters).GetAwaiter().GetResult();
PSOperationStatusResponse output = new PSOperationStatusResponse
{
StartTime = this.StartTime,
EndTime = DateTime.Now
};

if (result != null && result.Request != null && result.Request.RequestUri != null)
{
output.Name = GetOperationIdFromUrlString(result.Request.RequestUri.ToString());
}

WriteObject(output);
}
});
}

[Parameter(
ParameterSetName = "DefaultParameter",
Position = 0,
Mandatory = true,
ValueFromPipelineByPropertyName = true)]
[ResourceGroupCompleter]
public string ResourceGroupName { get; set; }

[Parameter(
ParameterSetName = "DefaultParameter",
Position = 1,
Mandatory = true,
ValueFromPipelineByPropertyName = true)]
[ResourceNameCompleter("Microsoft.Compute/virtualMachineScaleSets", "ResourceGroupName")]
[Alias("Name")]
public string VMScaleSetName { get; set; }

[Parameter(
Position = 2,
Mandatory = true,
ValueFromPipelineByPropertyName = true)]
[PSArgumentCompleter("AutomaticRepairs")]
public string ServiceName { get; set; }

[Parameter(
Position = 3,
Mandatory = true,
ValueFromPipelineByPropertyName = true)]
public string Action { get; set; }

[Parameter(
ParameterSetName = "ResourceIdParameter",
Position = 0,
Mandatory = true,
ValueFromPipelineByPropertyName = true)]
public string ResourceId { get; set; }

[Parameter(
ParameterSetName = "ObjectParameter",
Position = 0,
Mandatory = true,
ValueFromPipeline = true)]
[ValidateNotNullOrEmpty]
public PSVirtualMachineScaleSet InputObject { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }
}
}
18 changes: 10 additions & 8 deletions src/Compute/Compute/Images/GetAzureVMImageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Linq;
using System.Management.Automation;
using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.Azure.Commands.Compute.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Compute.Models;
using Microsoft.Rest.Azure.OData;
using System.Linq;
using System.Management.Automation;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;

namespace Microsoft.Azure.Commands.Compute
{
Expand Down Expand Up @@ -70,14 +71,16 @@ public class GetAzureVMImageCommand : VirtualMachineImageBaseCmdlet
public string Skus { get; set; }

[Parameter(ParameterSetName = ListVMImageParamSetName,
ValueFromPipelineByPropertyName = false),
ValidateNotNullOrEmpty]
ValueFromPipelineByPropertyName = false)]
[ValidateNotNullOrEmpty]
[CmdletParameterBreakingChange("FilterExpression",
ChangeDescription = "FilterExpression parameter will be removed because FilterExpression has not been supported by the API.")]
public string FilterExpression { get; set; }

[Parameter(ParameterSetName = GetVMImageDetailParamSetName,
Mandatory = true,
ValueFromPipelineByPropertyName = true),
ValidateNotNullOrEmpty]
ValueFromPipelineByPropertyName = true)]
[ValidateNotNullOrEmpty]
[SupportsWildcards]
public string Version { get; set; }

Expand All @@ -95,8 +98,7 @@ public override void ExecuteCmdlet()
this.Location.Canonicalize(),
this.PublisherName,
this.Offer,
this.Skus,
odataQuery: filter).GetAwaiter().GetResult();
this.Skus).GetAwaiter().GetResult();

var images = from r in result.Body
select new PSVirtualMachineImage
Expand Down
3 changes: 3 additions & 0 deletions src/Compute/Compute/help/Az.Compute.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ Sets the virtual machine scale set boot diagnostics profile.
### [Set-AzVmssDiskEncryptionExtension](Set-AzVmssDiskEncryptionExtension.md)
Enables disk encryption on a VM scale set.

### [Set-AzVmssOrchestrationServiceState](Set-AzVmssOrchestrationServiceState.md)
Sets the orchestration service state for the VMSS.

### [Set-AzVmssOsProfile](Set-AzVmssOsProfile.md)
Sets the VMSS operating system profile properties.

Expand Down
1 change: 1 addition & 0 deletions src/Compute/Compute/help/New-AzDiskConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ PS C:\> $galleryImageReference = @{Id = '/subscriptions/0296790d-427c-48ca-b204-
PS C:\> $diskConfig = New-AzDiskConfig -Location 'West US' -CreateOption 'FromImage' -GalleryImageReference $galleryImageReference;
PS C:\> New-AzDisk -ResourceGroupName 'ResourceGroup01' -DiskName 'Disk01' -Disk $diskConfig
```

Create a disk from a Shared Gallery Image Version. Id is the id of the shared gallery image version. Lun is needed only if the source is a data disk.

## PARAMETERS
Expand Down
Loading