Edit

Share via


Publish-AzVMDscConfiguration

Uploads a DSC script to Azure blob storage.

Syntax

UploadArchive (Default)

Publish-AzVMDscConfiguration
    [-ResourceGroupName] <String>
    [-ConfigurationPath] <String>
    [[-ContainerName] <String>]
    [-StorageAccountName] <String>
    [-StorageEndpointSuffix <String>]
    [-Force]
    [-SkipDependencyDetection]
    [-ConfigurationDataPath <String>]
    [-AdditionalPath <String[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

CreateArchive

Publish-AzVMDscConfiguration
    [-ConfigurationPath] <String>
    [[-OutputArchivePath] <String>]
    [-Force]
    [-SkipDependencyDetection]
    [-ConfigurationDataPath <String>]
    [-AdditionalPath <String[]>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

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

Examples

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

Publish-AzVMDscConfiguration ".\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

Publish-AzVMDscConfiguration ".\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

Publish-AzVMDscConfiguration -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

Publish-AzVMDscConfiguration -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

Publish-AzVMDscConfiguration -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.

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.

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

-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-AzVMDscExtension cmdlet

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

-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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:True
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

-ContainerName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UploadArchive
Position:4
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

-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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ConfigurationArchivePath

Parameter sets

CreateArchive
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UploadArchive
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-SkipDependencyDetection

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

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

-StorageAccountName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UploadArchive
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-StorageEndpointSuffix

Specifies the suffix for the storage end point.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

UploadArchive
Position:Named
Mandatory:False
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

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.

Inputs

String

String

Outputs

String