Set-AzureRmVMChefExtension

Adds a Chef extension to a virtual machine.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Set-AzureRmVMChefExtension
   [-ResourceGroupName] <String>
   [-VMName] <String>
   [[-TypeHandlerVersion] <String>]
   -ValidationPem <String>
   [-ClientRb <String>]
   [-BootstrapOptions <String>]
   [-JsonAttribute <String>]
   [-ChefDaemonInterval <String>]
   [-Daemon <String>]
   [-Secret <String>]
   [-SecretFile <String>]
   [-RunList <String>]
   [-ChefServerUrl <String>]
   [-ValidationClientName <String>]
   [-OrganizationName <String>]
   [-BootstrapVersion <String>]
   [-Linux]
   [[-Location] <String>]
   [[-Name] <String>]
   [[-AutoUpgradeMinorVersion] <Boolean>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzureRmVMChefExtension
   [-ResourceGroupName] <String>
   [-VMName] <String>
   [[-TypeHandlerVersion] <String>]
   -ValidationPem <String>
   [-ClientRb <String>]
   [-BootstrapOptions <String>]
   [-JsonAttribute <String>]
   [-ChefDaemonInterval <String>]
   [-Daemon <String>]
   [-Secret <String>]
   [-SecretFile <String>]
   [-RunList <String>]
   [-ChefServerUrl <String>]
   [-ValidationClientName <String>]
   [-OrganizationName <String>]
   [-BootstrapVersion <String>]
   [-Windows]
   [[-Location] <String>]
   [[-Name] <String>]
   [[-AutoUpgradeMinorVersion] <Boolean>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-AzureVMChefExtension cmdlet adds the Chef extension to the virtual machine.

Examples

Example 1: Add a Chef extension to a Windows virtual machine

PS C:\> Set-AzureRmVMChefExtension -ResourceGroupName "ResourceGroup001" -VMName "WindowsVM001" -ValidationPem "C:\my-org-validator.pem" -ClientRb "C:\client.rb" -RunList "Apache" -Daemon "service" -SecretFile "C:\my_encrypted_data_bag_secret" -Windows

This command adds a Chef extension to a Windows virtual machine named WindowsVM001. When the virtual machine starts, Chef bootstraps the virtual machine to run Apache.

Example 2: Add a Chef extension to a Linux virtual machine

PS C:\> Set-AzureRmVMChefExtension -ResourceGroupName "ResourceGroup002" -VMName "LinuxVM001" -ValidationPem "C:\my-org-validator.pem" -ClientRb "C:\client.rb" -RunList "Apache" -Secret "my_secret" -Linux

This command adds a Chef extension to a Linux virtual machine named LinuxVM001. When the virtual machine starts, Chef bootstraps the virtual machine to run Apache.

Example 3: Add a Chef extension to a Windows virtual machine with bootstrap options

PS C:\> Set-AzureRmVMChefExtension -ResourceGroupName "ResourceGroup003" -VMName "WindowsVM002" -ValidationPem C:\my-org-validator.pem -ClientRb C:\client.rb -BootstrapOptions '{"chef_node_name":"your_node_name","chef_server_url":"https://api.opscode.com/organizations/some-org", "validation_client_name":"some-org-validator"}' -RunList "Apache" -Windows

This command adds the Chef extension to a Windows virtual machine named WindowsVM002. When the virtual machine starts, Chef bootstraps the virtual machine to run Apache. After bootstrapping, the virtual machine refers to the BootstrapOptions specified in JSON format.

Parameters

-AutoUpgradeMinorVersion

Type:Boolean
Position:10
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-BootstrapOptions

Specifies configuration settings in the client_rb option.

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

-BootstrapVersion

Specifies the version of the bootstrap configuration.

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

-ChefDaemonInterval

Specifies the frequency (in minutes) at which the chef-service runs. If in case you don't want the chef-service to be installed on the Azure VM then set value as 0 in this field.

Type:String
Aliases:ChefServiceInterval
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ChefServerUrl

Specifies the Chef server link, as a URL.

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

-ClientRb

Specifies the full path of the Chef client.rb.

Type:String
Position:Named
Default value:None
Required:False
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

-Daemon

Configures the chef-client service for unattended execution. The node platform should be Windows. Allowed options: 'none','service' and 'task'. none - Currently prevents the chef-client service from being configured as a service. service - Configures the chef-client to run automatically in the background as a service. task - Configures the chef-client to run automatically in the background as a secheduled task.

Type:String
Accepted values:none, service, task
Position:Named
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:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JsonAttribute

A JSON string to be added to the first run of chef-client. e.g. -JsonAttribute '{"foo" : "bar"}'

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

-Linux

Indicates that this cmdlet creates a Windows virtual machine.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Location

Specifies the location of the virtual machine.

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

-Name

Specifies the name of the Chef extension.

Type:String
Aliases:ExtensionName
Position:8
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-OrganizationName

Specifies the organization name of the Chef extension.

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

-ResourceGroupName

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

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

-RunList

Specifies the Chef node run list.

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

-Secret

The encryption key used to encrypt and decrypt the data bag item values.

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

-SecretFile

The path to the file that contains the encryption key used to encrypt and decrypt the data bag item values.

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

-TypeHandlerVersion

Specifies the version of the extension to use for this virtual machine.

Type:String
Aliases:HandlerVersion, Version
Position:9
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ValidationClientName

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

-ValidationPem

Specifies the Chef validator .pem file path

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

-VMName

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

Type:String
Aliases:ResourceName
Position:1
Default value:None
Required:True
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

-Windows

Indicates that this cmdlet creates a Windows virtual machine.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Boolean

Outputs

PSAzureOperationResponse