Editar

Compartilhar via


Publish-AzVMDscConfiguration

Uploads a DSC script to Azure blob storage.

Syntax

Publish-AzVMDscConfiguration
       [-ResourceGroupName] <String>
       [-ConfigurationPath] <String>
       [[-ContainerName] <String>]
       [-StorageAccountName] <String>
       [-StorageEndpointSuffix <String>]
       [-Force]
       [-SkipDependencyDetection]
       [-ConfigurationDataPath <String>]
       [-AdditionalPath <String[]>]
       [-DefaultProfile <IAzureContextContainer>]
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
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.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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-AzVMDscExtension cmdlet

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

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required: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
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

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

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

-SkipDependencyDetection

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
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
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-StorageEndpointSuffix

Specifies the suffix for the storage end point.

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

Inputs

String

String[]

Outputs

String