Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
New-AzConnectedMachineExtension
- Module:
- Az.ConnectedMachine Module
The operation to create the extension.
Syntax
CreateExpanded (Default)
New-AzConnectedMachineExtension
-MachineName <String>
-Name <String>
-ResourceGroupName <String>
-Location <String>
[-SubscriptionId <String>]
[-AutoUpgradeMinorVersion]
[-EnableAutomaticUpgrade]
[-ExtensionType <String>]
[-ForceRerun <String>]
[-InstanceViewName <String>]
[-InstanceViewType <String>]
[-InstanceViewTypeHandlerVersion <String>]
[-ProtectedSetting <Hashtable>]
[-Publisher <String>]
[-Setting <Hashtable>]
[-StatusCode <String>]
[-StatusDisplayStatus <String>]
[-StatusLevel <String>]
[-StatusMessage <String>]
[-StatusTime <DateTime>]
[-Tag <Hashtable>]
[-TypeHandlerVersion <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaJsonString
New-AzConnectedMachineExtension
-MachineName <String>
-Name <String>
-ResourceGroupName <String>
-JsonString <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaJsonFilePath
New-AzConnectedMachineExtension
-MachineName <String>
-Name <String>
-ResourceGroupName <String>
-JsonFilePath <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Create
New-AzConnectedMachineExtension
-MachineName <String>
-Name <String>
-ResourceGroupName <String>
-ExtensionParameter <IMachineExtension>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaIdentityMachineExpanded
New-AzConnectedMachineExtension
-Name <String>
-MachineInputObject <IConnectedMachineIdentity>
-Location <String>
[-AutoUpgradeMinorVersion]
[-EnableAutomaticUpgrade]
[-ExtensionType <String>]
[-ForceRerun <String>]
[-InstanceViewName <String>]
[-InstanceViewType <String>]
[-InstanceViewTypeHandlerVersion <String>]
[-ProtectedSetting <Hashtable>]
[-Publisher <String>]
[-Setting <Hashtable>]
[-StatusCode <String>]
[-StatusDisplayStatus <String>]
[-StatusLevel <String>]
[-StatusMessage <String>]
[-StatusTime <DateTime>]
[-Tag <Hashtable>]
[-TypeHandlerVersion <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaIdentityMachine
New-AzConnectedMachineExtension
-Name <String>
-MachineInputObject <IConnectedMachineIdentity>
-ExtensionParameter <IMachineExtension>
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaIdentityExpanded
New-AzConnectedMachineExtension
-InputObject <IConnectedMachineIdentity>
-Location <String>
[-AutoUpgradeMinorVersion]
[-EnableAutomaticUpgrade]
[-ExtensionType <String>]
[-ForceRerun <String>]
[-InstanceViewName <String>]
[-InstanceViewType <String>]
[-InstanceViewTypeHandlerVersion <String>]
[-ProtectedSetting <Hashtable>]
[-Publisher <String>]
[-Setting <Hashtable>]
[-StatusCode <String>]
[-StatusDisplayStatus <String>]
[-StatusLevel <String>]
[-StatusMessage <String>]
[-StatusTime <DateTime>]
[-Tag <Hashtable>]
[-TypeHandlerVersion <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaIdentity
New-AzConnectedMachineExtension
-InputObject <IConnectedMachineIdentity>
-ExtensionParameter <IMachineExtension>
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The operation to create the extension.
Examples
Example 1: Add a new extension to a machine
$Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
New-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName win-eastus1 -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
Name Location ProvisioningState
---- -------- -----------------
custom eastus Succeeded
Sets an extension on a machine.
Example 2: Add a new extension with extension parameters specified via the pipeline
$otherExtension = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
$otherExtension | New-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName important
Name Location ProvisioningState
---- -------- -----------------
custom eastus Succeeded
This creates a new extension with the extension parameters provided by the object passed in via the pipeline. This is great if you want to grab the parameters of one machine and apply it to another machine.
Example 3: Add a new extension with location specified via the pipeline
$identity = [Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine.Models.ConnectedMachineIdentity]@{
Id = "/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.HybridCompute/machines/$MachineName/extensions/$ExtensionName"
}
$Settings = @{ "commandToExecute" = "powershell.exe -c Get-Process" }
$identity | New-AzConnectedMachineExtension -Location eastus -Publisher "Microsoft.Compute" -TypeHandlerVersion 1.10 -Settings $Settings -ExtensionType CustomScriptExtension
Name Location ProvisioningState
---- -------- -----------------
custom eastus Succeeded
This creates a new machine extension using the identity provided via the pipeline. You likely won't do this, but it's possible.
Example 4: Add a new extension using an extension object as both the location and parameters for updating
$ext = Get-AzConnectedMachineExtension -Name custom -ResourceGroupName ContosoTest -MachineName other
$ext | New-AzConnectedMachineExtension -ExtensionParameter $ext
This creates a new machine extension using the identity provided via the pipeline and the extension details provided by the passed in extension object. You likely won't do this, but it's possible.
Parameters
-AsJob
Run the command as a job
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AutoUpgradeMinorVersion
Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DefaultProfile
The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
Parameter properties
| Type: | PSObject |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzureRMContext, AzureCredential |
Parameter sets
-EnableAutomaticUpgrade
Indicates whether the extension should be automatically upgraded by the platform if there is a newer version available.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ExtensionParameter
Describes a Machine Extension.
Parameter properties
| Type: | IMachineExtension |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ExtensionType
Specifies the type of the extension; an example is "CustomScriptExtension".
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ForceRerun
How the extension handler should be forced to update even if the extension configuration has not changed.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InputObject
Identity Parameter
Parameter properties
| Type: | IConnectedMachineIdentity |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InstanceViewName
The machine extension name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InstanceViewType
Specifies the type of the extension; an example is "CustomScriptExtension".
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-InstanceViewTypeHandlerVersion
Specifies the version of the script handler.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-JsonFilePath
Path of Json file supplied to the Create operation
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-JsonString
Json string supplied to the Create operation
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Location
The geo-location where the resource lives
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MachineInputObject
Identity Parameter
Parameter properties
| Type: | IConnectedMachineIdentity |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-MachineName
The name of the machine where the extension should be created or updated.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
The name of the machine extension.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-NoWait
Run the command asynchronously
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ProtectedSetting
The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ProtectedSettings |
Parameter sets
-Publisher
The name of the extension handler publisher.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
The name of the resource group. The name is case insensitive.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Setting
Json formatted public settings for the extension.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Settings |
Parameter sets
-StatusCode
The status code.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StatusDisplayStatus
The short localizable label for the status.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StatusLevel
The level code.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StatusMessage
The detailed status message, including for alerts and error messages.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-StatusTime
The time of the status.
Parameter properties
| Type: | DateTime |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SubscriptionId
The ID of the target subscription.
Parameter properties
| Type: | String |
| Default value: | (Get-AzContext).Subscription.Id |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Tag
Resource tags.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-TypeHandlerVersion
Specifies the version of the script handler.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
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
IConnectedMachineIdentity
IMachineExtension
Outputs
IMachineExtension
Azure PowerShell
Feedback
Was this page helpful?
