Set-AzureVMCustomScriptExtension

Sets information for an Azure virtual machine custom script extension.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Set-AzureVMCustomScriptExtension
   [[-ReferenceName] <String>]
   [[-Version] <String>]
   [-ContainerName] <String>
   [-FileName] <String[]>
   [[-StorageAccountName] <String>]
   [[-StorageEndpointSuffix] <String>]
   [[-StorageAccountKey] <String>]
   [[-Run] <String>]
   [[-Argument] <String>]
   [-ForceUpdate]
   -VM <IPersistentVM>
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureVMCustomScriptExtension
   [[-ReferenceName] <String>]
   [[-Version] <String>]
   [-Disable]
   [-ForceUpdate]
   -VM <IPersistentVM>
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureVMCustomScriptExtension
   [[-ReferenceName] <String>]
   [[-Version] <String>]
   [-Uninstall]
   [-ForceUpdate]
   -VM <IPersistentVM>
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]
Set-AzureVMCustomScriptExtension
   [[-ReferenceName] <String>]
   [[-Version] <String>]
   [[-FileUri] <String[]>]
   [-Run] <String>
   [[-Argument] <String>]
   [-ForceUpdate]
   -VM <IPersistentVM>
   [-Profile <AzureSMProfile>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [<CommonParameters>]

Description

The Set-AzureVMCustomScriptExtension cmdlet sets information for an Azure virtual machine custom script extension.

Examples

Example 1: Set information for a virtual machine custom script extension

PS C:\> $VM = Set-AzureVMCustomScriptExtension -VM $VM -ContainerName "Container01" -FileName "script1.ps1","script2.ps1" -Run "script1.ps1" -Argument "arg1 arg2";
PS C:\> New-AzureVM -Location "West US" -ServiceName $SVC -VM $VM;

This command sets information for a virtual machine custom script extension.

Example 2: Set information for a virtual machine custom script extension using a file path

PS C:\> Set-AzureVMCustomScriptExtension -VM $VM -FileUri "http://www.blob.core.contoso.net/bar/script1.ps1","http://www.blob.core.contoso.net/baz/script2.ps1" -Run "script1.ps1" -Argument "arg1 arg2";
PS C:\> Update-AzureVM -ServiceName $SVC -Name $Name -VM VM;

This command sets information for a virtual machine custom script extension using multiple file URLs.

Parameters

-Argument

Specifies a string that supplies an argument that this cmdlet runs on the virtual machine.

Type:String
Position:8
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ContainerName

Specifies the container name within the storage account.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Disable

Indicates that this cmdlet disables the extension state.

Type:SwitchParameter
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-FileName

Specifies a string array that contains the names of the blob files in the specified container.

Type:String[]
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-FileUri

Specifies a string array that contains the URLs of the blob files.

Type:String[]
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ForceUpdate

Indicates that this cmdlet re-apply a configuration to an extension when the configuration has not been updated.

Type:SwitchParameter
Position:9
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InformationAction

Specifies how this cmdlet responds to an information event.

The acceptable values for this parameter are:

  • Continue
  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ReferenceName

Specifies the reference name for the extension.

This parameter is a user-defined string that can be used to refer to an extension. It is specified when the extension is added to the virtual machine for the first time. For subsequent updates, you need to specify the previously used reference name while updating the extension. The ReferenceName assigned to an extension is returned using the Get-AzureVM cmdlet.

Type:String
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Run

Specifies the command this cmdlet runs by the extension on the virtual machine. Only "powershell.exe" is supported.

Type:String
Aliases:RunFile, Command
Position:7
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-StorageAccountKey

Specifies the storage account key

Type:String
Position:6
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StorageAccountName

Specifies the storage account name in the current subscription.

Type:String
Position:4
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-StorageEndpointSuffix

Specifies the storage service endpoint.

Type:String
Position:5
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Uninstall

Indicates that this cmdlet uninstalls the custom script extension from the virtual machine.

Type:SwitchParameter
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Version

Specifies the version of the custom script extension.

Type:String
Position:1
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VM

Specifies the persistent virtual machine object.

Type:IPersistentVM
Aliases:InputObject
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False