Set-AzVMDscExtension
Configures the DSC extension on a virtual machine.
Syntax
Default (Default)
Set-AzVMDscExtension
[-ResourceGroupName] <String>
[-VMName] <String>
[-Name <String>]
[-ArchiveBlobName] <String>
[-ArchiveStorageAccountName] <String>
[-ArchiveResourceGroupName <String>]
[-ArchiveStorageEndpointSuffix <String>]
[-ArchiveContainerName <String>]
[-ConfigurationName <String>]
[-ConfigurationArgument <Hashtable>]
[-ConfigurationData <String>]
[-Version] <String>
[-Force]
[-Location <String>]
[-AutoUpdate]
[-WmfVersion <String>]
[-DataCollection <String>]
[-NoWait]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzVMDscExtension cmdlet configures the Windows PowerShell Desired State Configuration (DSC) extension on a virtual machine in a resource group.
Examples
Example 1: Set a DSC extension
Set-AzVMDscExtension -ResourceGroupName "ResourceGroup001" -VMName "VM07" -ArchiveBlobName "Sample.ps1.zip" -ArchiveStorageAccountName "Stg" -ConfigurationName "ConfigName" -Version "1.10" -Location "West US"
This command sets the DSC extension on the virtual machine named VM07 to download Sample.ps1.zip from the storage account named Stg and the default container.
The command invokes the configuration named ConfigName.
The Sample.ps1.zip file was previously uploaded by using Publish-AzVMDscConfiguration .
Example 2: Set a DSC extension with configuration data
Set-AzVMDscExtension -ResourceGroupName "ResourceGroup001" -VMName "VM13" -ArchiveBlobName "Sample.ps1.zip" -ArchiveStorageAccountName "Stg" -ConfigurationName "ConfigName" -ConfigurationArgument "@{arg="val"}" -ArchiveContainerName "WindowsPowerShellDSC" -ConfigurationData "SampleData.psd1" -Version "1.10" -Location "West US"
This command sets the extension on the virtual machine named VM13 to download Sample.ps1.zip from the storage account named Stg and the container named WindowsPowerShellDSC.
The command the configuration named ConfigName and specifies configuration data and arguments.
The Sample.ps1.zip file was previously uploaded by using Publish-AzVMDscConfiguration .
Example 3: Set a DSC extension with configuration data that has auto update
Set-AzVMDscExtension -ResourceGroupName "ResourceGroup001" -VMName "VM22" -ArchiveBlobName "Sample.ps1.zip" -ArchiveStorageAccountName "Stg" -ConfigurationName "ConfigName" -ConfigurationArgument "@{arg="val"}" -ArchiveContainerName WindowsPowerShellDSC -ConfigurationData "SampleData.psd1" -Version "1.10" -Location "West US" -AutoUpdate
This command sets the extension on the virtual machine named VM22 to download Sample.ps1.zip from the storage account named Stg and the container named WindowsPowerShellDSC.
The command invokes the configuration named ConfigName and specifies configuration data and arguments.
This command also enables auto update of extension handler to the latest version.
The Sample.ps1.zip was previously uploaded by using Publish-AzVMDscConfiguration .
Parameters
-ArchiveBlobName
Specifies the name of the configuration file that was previously uploaded by the Publish-AzVMDscConfiguration cmdlet.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ConfigurationArchiveBlob
Parameter sets
(All)
Position: 5
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ArchiveContainerName
Species name of the Azure storage container where the configuration archive is located.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: ContainerName
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ArchiveResourceGroupName
Specifies the name of the resource group that contains the storage account that contains the configuration archive.
This parameter is optional if the storage account and virtual machine are both in the same resource group.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ArchiveStorageAccountName
Specifies the Azure storage account name that is used to download the ArchiveBlobName.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: StorageAccountName
Parameter sets
(All)
Position: 4
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ArchiveStorageEndpointSuffix
Specifies the storage endpoint suffix.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: StorageEndpointSuffix
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-AutoUpdate
Specifies the extension handler version specified by the Version parameter.
By default extension handler is not autoupdated.
Use the AutoUpdate parameter to enable auto update of the extension handler to the latest version as and when it is available.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ConfigurationArgument
Specifies a hash table that contains the arguments to the configuration function.
Parameter properties
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ConfigurationData
Specifies the path of a .psd1 file that specifies the data for the configuration.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ConfigurationName
Specifies the name of the configuration that the DSC Extension invokes.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DataCollection
Specifies the data collection type.
The acceptable values for this parameter are: Enable and Disable.
Parameter properties
Type: String
Default value: None
Accepted values: Enable, Disable
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
Type: IAzureContextContainer
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Force
Forces the command to run without asking for user confirmation.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Location
Specifies the path of the resource extension.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Name
Specifies the name of the Azure Resource Manager resource that represents the extension.
The default value is Microsoft.Powershell.DSC.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-NoWait
Starts the operation and returns immediately, before the operation is completed. In order to determine if the operation has successfully been completed, use some other mechanism.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
Specifies the name of the resource group of the virtual machine.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-Version
Specifies the version of the DSC extension that Set-AzVMDscExtension applies the settings to.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: HandlerVersion
Parameter sets
(All)
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-VMName
Specifies the name of the virtual machine where DSC extension handler is installed.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 3
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: False
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WmfVersion
Specifies the WMF version.
Parameter properties
Type: String
Default value: None
Accepted values: 4.0, 5.0, 5.1, latest
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs