< Back

Set-AzureRmVMCustomScriptExtension

Tue Jan 29, 2019 9:39 pm

NAME Set-AzureRmVMCustomScriptExtension



SYNOPSIS

Adds a custom script extension to a virtual machine.





SYNTAX

Set-AzureRmVMCustomScriptExtension [-ResourceGroupName] <String> [-VMName] <String> [-Argument <String>] -ContainerName <String> [-DefaultProfile

<IAzureContextContainer>] [-DisableAutoUpgradeMinorVersion] -FileName <String[]> [-ForceRerun <String>] [-Location <String>] [-Name <String>]

[-Run <String>] [-SecureExecution] [-StorageAccountKey <String>] [-StorageAccountName <String>] [-StorageEndpointSuffix <String>]

[-TypeHandlerVersion <String>] [-Confirm] [-WhatIf] [<CommonParameters>]



Set-AzureRmVMCustomScriptExtension [-ResourceGroupName] <String> [-VMName] <String> [-Argument <String>] [-DefaultProfile

<IAzureContextContainer>] [-DisableAutoUpgradeMinorVersion] [-FileUri <String[]>] [-ForceRerun <String>] [-Location <String>] [-Name <String>]

[-Run <String>] [-SecureExecution] [-TypeHandlerVersion <String>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Set-AzureRmVMCustomScriptExtension cmdlet adds a custom script Virtual Machine Extension to a virtual machine. This extension lets you run

your own scripts on the virtual machine.





PARAMETERS

-Argument <String>

Specifies arguments that the script extension passes to the script.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ContainerName <String>

Specifies the name of the Azure storage container where this cmdlet stores the script.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DisableAutoUpgradeMinorVersion [<SwitchParameter>]





Required? false

Position? named

Default value False

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-FileName <String[]>

Specifies the name of the script file. If the file is stored in Azure Blob storage, the file name value is case-senstive. File names of files

stored in Azure File storage are not case-senstive.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-FileUri <String[]>

Specifies the URI of the script file.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ForceRerun <String>

Indicates that this cmdlet forces a rerun of the same extension configuration on the virtual machine without uninstalling and reinstalling the

extension. The value can be any string different from the current value.



If forceUpdateTag is not changed, updates to public or protected settings are still applied by the handler.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Location <String>

Specifies the location of the virtual machine.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>

Specifies the name of the custom script extension.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceGroupName <String>

Specifies the name of the resource group of the virtual machine.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Run <String>

Specifies the command to use that runs your script.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-SecureExecution [<SwitchParameter>]

Indicates that this cmdlet makes sure that the value of the Run parameter is not logged on the server or returned to the user by using the GET

extension API. The value of Run might contain secrets or passwords to be passed to the script file securely.



Required? false

Position? named

Default value False

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-StorageAccountKey <String>

Specifies the key for the Azure storage container.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-StorageAccountName <String>

Specifies the name of the Azure storage account where this cmdlet stores the script.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-StorageEndpointSuffix <String>

Specifies the storage endpoint suffix.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-TypeHandlerVersion <String>

Specifies the version of the extension to use for this virtual machine. To obtain the version, run the Get-AzureRmVMExtensionImage cmdlet with

a value of Microsoft.Compute for the PublisherName parameter and VMAccessAgent for the Type parameter.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VMName <String>

Specifies the name of a virtual machine. This cmdlet adds the custom script extension for the virtual machine that this parameter specifies.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs.



The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Compute.Models.PSAzureOperationResponse







NOTES









Example 1: Add a custom script



PS C:\\> Set-AzureRmVMCustomScriptExtension -ResourceGroupName "ResourceGroup11" -Location "Central US" -VMName "VirtualMachine07" -Name

"ContosoTest" -TypeHandlerVersion "1.1" -StorageAccountName "Contoso" -StorageAccountKey <StorageKey> -FileName "ContosoScript.exe" -ContainerName

"Scripts"



This command adds a custom script to the virtual machine named VirtualMachine07. The script file is contososcript.exe.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... textension

Get-AzureRmVMCustomScriptExtension

Remove-AzureRmVMCustomScriptExtension