Add-AzureRmVmssExtension

Adds an extension to the VMSS.

Syntax

Add-AzureRmVmssExtension
   [-VirtualMachineScaleSet] <PSVirtualMachineScaleSet>
   [[-Name] <String>]
   [[-Publisher] <String>]
   [[-Type] <String>]
   [[-TypeHandlerVersion] <String>]
   [[-AutoUpgradeMinorVersion] <Boolean>]
   [[-Setting] <Object>]
   [[-ProtectedSetting] <Object>]
   [-ForceUpdateTag <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Add-AzureRmVmssExtension cmdlet adds an extension to the Virtual Machine Scale Set (VMSS).

Examples

Example 1: Add an extension to the VMSS

PS C:\> Add-AzureRmVmssExtension -VirtualMachineScaleSet $VMSS -Name $ExtName -Publisher $Publisher -Type $ExtType -TypeHandlerVersion $ExtVer -AutoUpgradeMinorVersion $True

This command adds an extension to the VMSS.

Example 2: Add an extension to the VMSS with settings and protected settings

PS C:\> $Settings = @{"fileUris" = "[]"; "commandToExecute" = ""};
PS C:\> $ProtectedSettings = @{"storageAccountName" = $stoname; "storageAccountKey" = $stokey};

PS C:\> Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Name $vmssExtensionName -Publisher $vmssPublisher  `
  -Type $vmssExtensionType -TypeHandlerVersion $ExtVer -AutoUpgradeMinorVersion $True  `
  -Setting $Settings -ProtectedSetting $ProtectedSettings

This command adds an extension to the VMSS with a sample bash script on a blob storage, specify the url of blob storage and executable command in settings and security access in protected settings.

Parameters

-AutoUpgradeMinorVersion

Indicates whether the extension version should be automatically updated to a newer minor version.

Type:System.Nullable`1[System.Boolean]
Position:5
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceUpdateTag

If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the name of the extension that this cmdlet adds.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ProtectedSetting

Specifies private configuration for the extension, as a string. This cmdlet encrypts the private configuration.

Type:Object
Position:7
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Publisher

Specifies the name of the extension publisher. The publisher provides a name when the publisher registers an extension. This can use the Get-AzureRmVMImagePublisher cmdlet to get the publisher.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Setting

Specifies the public configuration, as a string, for the extension. This cmdlet does not encrypt public configuration.

Type:Object
Position:6
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Type

Specifies the extension type. You can use the Get-AzureRmVMExtensionImageType cmdlet to get the extension type.

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-TypeHandlerVersion

Specifies the version of the extension to use for this virtual machine. You can use the Get-AzureRmVMExtensionImage cmdlet to get the version of the extension.

Type:String
Position:4
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VirtualMachineScaleSet

Specify the VMSS object. You can use the New-AzureRmVmssConfig to create the object.

Type:PSVirtualMachineScaleSet
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName, ByValue)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSVirtualMachineScaleSet

String

System.Nullable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Object

Outputs

PSVirtualMachineScaleSet