Publish-​Azure​Rm​VM​Dsc​Configuration

Uploads a DSC script to Azure blob storage.

Syntax

Publish-AzureRmVMDscConfiguration
       [-ConfigurationPath] <String>
       [-ResourceGroupName] <String>
       [-StorageAccountName] <String>
       [[-ContainerName] <String>]
       [-AdditionalPath <String[]>]
       [-ConfigurationDataPath <String>]
       [-Force]
       [-SkipDependencyDetection]
       [-StorageEndpointSuffix <String>]
       [-Confirm]
       [-WhatIf]
       [<CommonParameters>]
Publish-AzureRmVMDscConfiguration
       [-ConfigurationPath] <String>
       [[-OutputArchivePath] <String>]
       [-AdditionalPath <String[]>]
       [-ConfigurationDataPath <String>]
       [-Force]
       [-SkipDependencyDetection]
       [-Confirm]
       [-WhatIf]
       [<CommonParameters>]

Description

The Publish-AzureRmVMDscConfiguration cmdlet uploads a Desired State Configuration (DSC) script to Azure blob storage, which later can be applied to Azure virtual machines using the Set-AzureRmVMDscExtension cmdlet.

Examples

Example 1: Create a .zip package an upload it to Azure storage

PS C:\>Publish-AzureRmVMDscConfiguration ".\MyConfiguration.ps1"

This command creates a .zip package for the given script and any dependent resource modules and uploads it to Azure storage.

Example 2: Create a .zip package and store it to a local file

PS C:\>Publish-AzureRmVMDscConfiguration ".\MyConfiguration.ps1" -OutputArchivePath ".\MyConfiguration.ps1.zip"

This command creates a .zip package for the given script and any dependent resource modules and stores it in the local file that is named .\MyConfiguration.ps1.zip.

Example 3: Add configuration to the archive and then upload it to storage

PS C:\>Publish-AzureRmVMDscConfiguration -ConfigurationPath "C:\Sample.ps1" -SkipDependencyDetection

This command adds configuration named Sample.ps1 to the configuration archive to upload to Azure storage and skips dependent resource modules.

Example 4: Add configuration and configuration data to the archive and then upload it to storage

PS C:\>Publish-AzureRmVMDscConfiguration -ConfigurationPath "C:\Sample.ps1" -ConfigurationDataPath "C:\SampleData.psd1"

This command adds configuration named Sample.ps1 and configuration data named SampleData.psd1 to the configuration archive to upload to Azure storage.

Example 5: Add configuration, configuration data, and additional content to the archive and then upload it to storage

PS C:\>Publish-AzureRmVMDscConfiguration -ConfigurationPath "C:\Sample.ps1" -AdditionalPath @("C:\ContentDir1", "C:\File.txt") -ConfigurationDataPath "C:\SampleData.psd1"

This command adds configuration named Sample.ps1, configuration data SampleData.psd1, and additional content to configuration archive to upload to Azure storage.

Required Parameters

-ConfigurationPath

Specifies the path of a file that contains one or more configurations. The file can be a Windows PowerShell script (.ps1) file or a Windows PowerShell module (.psm1) file.

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

Specifies the name of the resource group that contains the storage account.

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

Specifies the Azure storage account name that is used to upload the configuration script to the container specified by the ContainerName parameter.

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

Optional Parameters

-AdditionalPath

Specifies the path of a file or a directory to include in the configuration archive. It gets downloaded to the virtual machine together with the configuration.

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

Specifies the path of a .psd1 file that specifies the data for the configuration. This is added to the configuration archive and then passed to the configuration function. It gets overwritten by the configuration data path provided through the Set-AzureRmVMDscExtension cmdlet

Type:String
Position:Named
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:False
Accept pipeline input:False
Accept wildcard characters:False
-ContainerName

Specifies the name of the Azure storage container the configuration is uploaded to.

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

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-OutputArchivePath

Specifies the path of a local .zip file to write the configuration archive to. When this parameter is used, the configuration script is not uploaded to Azure blob storage.

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

Indicates that this cmdlet excludes DSC resource dependencies from the configuration archive.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StorageEndpointSuffix

Specifies the suffix for the storage end point.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
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:False
Accept pipeline input:False
Accept wildcard characters:False