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
4 changes: 2 additions & 2 deletions src/Compute/Compute/Az.Compute.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.Compute.dll',

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Get-AzGalleryApplication', 'Get-AzGalleryApplicationVersion',
'Get-AzVmssVMRunCommand', 'New-AzGalleryApplication',
'New-AzGalleryApplication',
'New-AzGalleryApplicationVersion', 'Remove-AzGalleryApplication',
'Remove-AzGalleryApplicationVersion', 'Remove-AzVMRunCommand',
'Remove-AzVmssVMRunCommand', 'Set-AzVMRunCommand',
Expand Down Expand Up @@ -195,7 +195,7 @@ CmdletsToExport = 'Remove-AzAvailabilitySet', 'Get-AzAvailabilitySet',
'Add-AzVmGalleryApplication', 'Add-AzVmssGalleryApplication',
'Remove-AzVmGalleryApplication', 'Remove-AzVmssGalleryApplication',
'Add-AzVmssRunCommand', 'Remove-AzVmssRunCommand',
'Get-AzVMRunCommand'
'Get-AzVMRunCommand', 'Get-AzVmssVMRunCommand'

# Variables to export from this module
VariablesToExport = '*'
Expand Down
3 changes: 2 additions & 1 deletion src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
* Added Disk Delete Optional parameters `OsDisk Deletion Option` and `Delete Option` to the `Set-AzVmssStorageProfile` (OS Disk) and `Add-AzVmssDataDisk` (Data Disk)
* Improved printed output for `Get-AzComputeResourceSku`
* Updated `Get-AzHost` cmdlet logic to return Host for `-ResourceId` parameterset.
* For `New-AzGalleryImageVersion`, update property mapping for `Encryption`.
* Updated property mapping for parameter `Encryption` of `New-AzGalleryImageVersion`
* Updated list format to display all VmssVmRunCommand properties for `Get-AzVmssVmRunCommand`

## Version 4.32.0
* Added the `TimeCreated` property to the Virtual Machine and Virtual Machine Scale Set models.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------

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.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "VmssVMRunCommand")]
[OutputType(typeof(PSVirtualMachineRunCommand))]
public class GetAzureVmssVMRunCommand : ComputeAutomationBaseCmdlet
{
[Parameter(
ValueFromPipelineByPropertyName = true,
Mandatory = true,
HelpMessage = "Name of the resource group for the run command.")]
[ResourceGroupCompleter]
[SupportsWildcards]
public string ResourceGroupName { get; set; }

[Parameter(
ValueFromPipelineByPropertyName = true,
Mandatory = true,
HelpMessage = "Name of the virtual machine scale set of the run command.")]
[ResourceNameCompleter("Microsoft.Compute/virtualMachineScaleSets", "ResourceGroupName")]
public string VMScaleSetName { get; set; }

[Parameter(
ValueFromPipelineByPropertyName = true,
Mandatory = true,
HelpMessage = "Instance ID of the virtual machine for from the VM scale set.")]
public string InstanceId { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Name of the run command.")]
public string RunCommandName { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "For instance view, pass in \"InstanceView\".")]
[PSArgumentCompleter("InstanceView")]
public string Expand { get; set; }

public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
ExecuteClientAction(() =>
{

if (this.IsParameterBound(c => c.RunCommandName))
{
VirtualMachineRunCommand vmssVmRc = VirtualMachineScaleSetVMRunCommandsClient.Get(this.ResourceGroupName, this.VMScaleSetName, this.InstanceId, this.RunCommandName, this.Expand);
PSVirtualMachineRunCommand psObject = new PSVirtualMachineRunCommand();
ComputeAutomationAutoMapperProfile.Mapper.Map<VirtualMachineRunCommand, PSVirtualMachineRunCommand>(vmssVmRc, psObject);
WriteObject(psObject);
}
else
{
var vmssVmRc = VirtualMachineScaleSetVMRunCommandsClient.List(this.ResourceGroupName, this.VMScaleSetName, this.InstanceId, this.Expand);
var resultList = vmssVmRc.ToList();
var nextPageLink = vmssVmRc.NextPageLink;
while (!string.IsNullOrEmpty(nextPageLink))
{
var pageResult = VirtualMachineScaleSetVMRunCommandsClient.ListNext(nextPageLink);
foreach (var pageItem in pageResult)
{
resultList.Add(pageItem);
}
nextPageLink = pageResult.NextPageLink;
}
var psObject = new List<PSVirtualMachineRunCommandList>();
foreach (var r in resultList)
{
psObject.Add(ComputeAutomationAutoMapperProfile.Mapper.Map<VirtualMachineRunCommand, PSVirtualMachineRunCommandList>(r));
}
WriteObject(psObject);
}
});
}
}
}
2 changes: 1 addition & 1 deletion src/Compute/Compute/help/Az.Compute.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Gets the properties of a VMSS virtual machine.
Shows the disk encryption status of VMs in a VM scale set.

### [Get-AzVmssVMRunCommand](Get-AzVmssVMRunCommand.md)
The operation to get the VMSS VM run command.
Gets a specific Run Command or a list of Run Commands for a VM in VM scale set.

### [Get-AzVMUsage](Get-AzVMUsage.md)
Gets the virtual machine core count usage for a location.
Expand Down
33 changes: 3 additions & 30 deletions src/Compute/Compute/help/Get-AzVMRunCommand.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Accept wildcard characters: False
```

### -ResourceGroupName
The name of the resource group.
Name of the resource group for the run command.

```yaml
Type: System.String
Expand Down Expand Up @@ -118,39 +118,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## INPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.IComputeIdentity
### System.String

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IRunCommandDocument

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IRunCommandDocumentBase

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IVirtualMachineRunCommand
### Microsoft.Azure.Management.Compute.Models.PSVirtualMachineRunCommand

## NOTES

ALIASES

COMPLEX PARAMETER PROPERTIES

To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.


`INPUTOBJECT <IComputeIdentity>`: Identity Parameter
- `[CommandId <String>]`: The command id.
- `[GalleryApplicationName <String>]`: The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
- `[GalleryImageName <String>]`: The name of the gallery image definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
- `[GalleryImageVersionName <String>]`: The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
- `[GalleryName <String>]`: The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods allowed in the middle. The maximum length is 80 characters.
- `[Id <String>]`: Resource identity path
- `[InstanceId <String>]`: The instance ID of the virtual machine.
- `[Location <String>]`: The location upon which run commands is queried.
- `[ResourceGroupName <String>]`: The name of the resource group.
- `[RunCommandName <String>]`: The name of the virtual machine run command.
- `[SubscriptionId <String>]`: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
- `[VMName <String>]`: The name of the virtual machine where the run command should be created or updated.
- `[VMScaleSetName <String>]`: The name of the VM scale set.

## RELATED LINKS
115 changes: 23 additions & 92 deletions src/Compute/Compute/help/Get-AzVmssVMRunCommand.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
external help file: Az.Compute-help.xml
external help file: Microsoft.Azure.PowerShell.Cmdlets.Compute.dll-Help.xml
Module Name: Az.Compute
online version: https://docs.microsoft.com/powershell/module/az.compute/get-azvmssvmruncommand
schema: 2.0.0
Expand All @@ -12,23 +12,9 @@ The operation to get the VMSS VM run command.

## SYNTAX

### List (Default)
```
Get-AzVmssVMRunCommand -InstanceId <String> -ResourceGroupName <String> [-SubscriptionId <String[]>]
-VMScaleSetName <String> [-Expand <String>] [-DefaultProfile <PSObject>] [<CommonParameters>]
```

### Get
```
Get-AzVmssVMRunCommand -InstanceId <String> -ResourceGroupName <String> -RunCommandName <String>
[-SubscriptionId <String[]>] -VMScaleSetName <String> [-Expand <String>] [-DefaultProfile <PSObject>]
[<CommonParameters>]
```

### GetViaIdentity
```
Get-AzVmssVMRunCommand -InputObject <IComputeIdentity> [-Expand <String>] [-DefaultProfile <PSObject>]
[<CommonParameters>]
Get-AzVmssVMRunCommand -ResourceGroupName <String> -VMScaleSetName <String> -InstanceId <String>
[-RunCommandName <String>] [-Expand <String>] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -68,9 +54,9 @@ Get RunCommand by Instance
The credentials, account, tenant, and subscription used for communication with Azure.

```yaml
Type: System.Management.Automation.PSObject
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzureRMContext, AzureCredential
Aliases: AzContext, AzureRmContext, AzureCredential

Required: False
Position: Named
Expand All @@ -80,7 +66,7 @@ Accept wildcard characters: False
```

### -Expand
The expand expression to apply on the operation.
The expand expression to apply on the operation. For instance view, pass in "InstanceView".

```yaml
Type: System.String
Expand All @@ -90,99 +76,67 @@ Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -InputObject
Identity Parameter
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.IComputeIdentity
Parameter Sets: GetViaIdentity
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -InstanceId
The instance ID of the virtual machine.
Instance ID of the virtual machine for from the VM scale set.

```yaml
Type: System.String
Parameter Sets: List, Get
Parameter Sets: (All)
Aliases:

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

### -ResourceGroupName
The name of the resource group.
Name of the resource group for the run command.

```yaml
Type: System.String
Parameter Sets: List, Get
Parameter Sets: (All)
Aliases:

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

### -RunCommandName
The name of the virtual machine run command.
Name of the run command.

```yaml
Type: System.String
Parameter Sets: Get
Aliases:

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

### -SubscriptionId
Subscription credentials which uniquely identify Microsoft Azure subscription.
The subscription ID forms part of the URI for every service call.

```yaml
Type: System.String[]
Parameter Sets: List, Get
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: (Get-AzContext).Subscription.Id
Accept pipeline input: False
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -VMScaleSetName
The name of the VM scale set.
Name of the virtual machine scale set of the run command.

```yaml
Type: System.String
Parameter Sets: List, Get
Parameter Sets: (All)
Aliases:

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

Expand All @@ -191,35 +145,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## INPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.IComputeIdentity
### System.String

## OUTPUTS

### Microsoft.Azure.PowerShell.Cmdlets.Compute.Models.Api20210701.IVirtualMachineRunCommand
### Microsoft.Azure.Management.Compute.Models.PSVirtualMachineRunCommand

## NOTES

ALIASES

COMPLEX PARAMETER PROPERTIES

To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.


`INPUTOBJECT <IComputeIdentity>`: Identity Parameter
- `[CommandId <String>]`: The command id.
- `[GalleryApplicationName <String>]`: The name of the gallery Application Definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
- `[GalleryApplicationVersionName <String>]`: The name of the gallery Application Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
- `[GalleryImageName <String>]`: The name of the gallery image definition to be created or updated. The allowed characters are alphabets and numbers with dots, dashes, and periods allowed in the middle. The maximum length is 80 characters.
- `[GalleryImageVersionName <String>]`: The name of the gallery image version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: `<MajorVersion>.<MinorVersion>.<Patch>`
- `[GalleryName <String>]`: The name of the Shared Image Gallery. The allowed characters are alphabets and numbers with dots and periods allowed in the middle. The maximum length is 80 characters.
- `[Id <String>]`: Resource identity path
- `[InstanceId <String>]`: The instance ID of the virtual machine.
- `[Location <String>]`: The location upon which run commands is queried.
- `[ResourceGroupName <String>]`: The name of the resource group.
- `[RunCommandName <String>]`: The name of the virtual machine run command.
- `[SubscriptionId <String>]`: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
- `[VMName <String>]`: The name of the virtual machine where the run command should be created or updated.
- `[VMScaleSetName <String>]`: The name of the VM scale set.

## RELATED LINKS
Loading