Add-AzResourceMoverMoveResource
Crée ou met à jour une ressource Move dans la collection de déplacement.
La commande « Add-AzResourceMoverMoveResource » reste identique pour les collections de déplacement de type « RegionToRegion » et « RegionToZone ».
Syntaxe
Add-AzResourceMoverMoveResource
-MoveCollectionName <String>
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
[-DependsOnOverride <IMoveResourceDependencyOverride[]>]
[-ExistingTargetId <String>]
[-ResourceSetting <IResourceSettings>]
[-SourceId <String>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Crée ou met à jour une ressource Move dans la collection de déplacement.
La commande « Add-AzResourceMoverMoveResource » reste identique pour les collections de déplacement de type « RegionToRegion » et « RegionToZone ».
Exemples
Exemple 1 : Ajouter une ressource à la collection Move. (RegionToRegion)
$targetResourceSettingsObj = New-Object Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
$targetResourceSettingsObj.ResourceType = "Microsoft.Compute/virtualMachines"
$targetResourceSettingsObj.TargetResourceName = "PSDemoVM"
Add-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-centralus-westcentralus-demoRMS" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM" -Name "PSDemoVM" -ResourceSetting $targetResourceSettingsObj
DependsOn : {}
DependsOnOverride : {}
ErrorsPropertiesCode :
ErrorsPropertiesDetail :
ErrorsPropertiesMessage :
ErrorsPropertiesTarget :
ExistingTargetId :
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-centralus-westcentralus-demoRMS/moveResources/PSDemoVM
IsResolveRequired : False
JobStatusJobName :
JobStatusJobProgress :
MoveStatusErrorsPropertiesCode : DependencyComputationPending
MoveStatusErrorsPropertiesDetail : {}
MoveStatusErrorsPropertiesMessage : The dependency computation is not completed for resource - /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM. Possible Causes: Dependency computation is pending for resource. Recommended Action: Validate dependencies to compute the dependencies.
MoveStatusErrorsPropertiesTarget :
MoveStatusMoveState : PreparePending
Name : PSDemoVM
ProvisioningState : Succeeded
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
TargetId :
Type :
Ajoutez une ressource au type Move Collection « RegionToRegion ».
Exemple 2 : Ajouter une ressource à la collection Move. (RegionToZone)
$targetResourceSettingsObj = New-Object Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
$targetResourceSettingsObj.ResourceType = "Microsoft.Compute/virtualMachines"
$targetResourceSettingsObj.TargetResourceName = "demo-RegionToZone-VM-Target"
$targetResourceSettingsObj.TargetAvailabilityZone = "1"
Add-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-demo-RegionToZone" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PS-demo-RegionToZone-RG/providers/Microsoft.Compute/virtualMachines/demo-RegionToZone-VM" -Name "PSDemoVM-RegionToZone" -ResourceSetting $targetResourceSettingsObj
DependsOn : {}
DependsOnOverride : {}
ErrorsPropertiesCode :
ErrorsPropertiesDetail :
ErrorsPropertiesMessage :
ErrorsPropertiesTarget :
ExistingTargetId :
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollection
s/PS-demo-RegionToZone/moveResources/PSDemoVM-RegionToZone
IsResolveRequired : False
JobStatusJobName :
JobStatusJobProgress :
MoveStatusErrorsPropertiesCode : DependencyComputationPending
MoveStatusErrorsPropertiesDetail : {Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.MoveResourceErrorBody,
Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.MoveResourceErrorBody}
MoveStatusErrorsPropertiesMessage : The dependency computation is not completed for resource - /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PS-demo-R
egionToZone-RG/providers/Microsoft.Compute/virtualMachines/demo-RegionToZone-VM'.
Possible Causes: Dependency computation is pending for resource.
Recommended Action: Validate dependencies to compute the dependencies.
MoveStatusErrorsPropertiesTarget :
MoveStatusMoveState : MovePending
Name : PSDemoVM-RegionToZone
ProvisioningState : Succeeded
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PS-demo-RegionToZone-RG/providers/Microsoft.Compute/virtualMachines/
demo-RegionToZone-VM
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SystemDataCreatedAt : 9/5/2023 11:13:46 AM
SystemDataCreatedBy : xxxxxxx
SystemDataCreatedByType : User
SystemDataLastModifiedAt : 9/5/2023 11:13:46 AM
SystemDataLastModifiedBy : xxxxxxx
SystemDataLastModifiedByType : User
TargetId :
Type :
Ajoutez une ressource au type « RegionToZone » Move Collection.
Exemple 3 : Ajoutez une ressource à la collection Move qui a une ressource cible existante. (RegionToRegion)
Add-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-centralus-westcentralus-demoRMS" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/psdemorm" -Name "psdemorm" -ExistingTargetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PSDemoRM-target"
DependsOn : {}
DependsOnOverride : {}
ErrorsPropertiesCode :
ErrorsPropertiesDetail :
ErrorsPropertiesMessage :
ErrorsPropertiesTarget :
ExistingTargetId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PSDemoRM-target
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-centralus-westcentralus-demoRMS/moveResources/psdemorm
IsResolveRequired : False
JobStatusJobName :
JobStatusJobProgress :
MoveStatusErrorsPropertiesCode :
MoveStatusErrorsPropertiesDetail :
MoveStatusErrorsPropertiesMessage :
MoveStatusErrorsPropertiesTarget :
MoveStatusMoveState : CommitPending
Name : psdemorm
ProvisioningState : Succeeded
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.ResourceSettings
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/psdemorm
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.ResourceSettings
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
TargetId :
Type :
Ajoutez une ressource au type « RegionToRegion » Move Collection qui a une ressource cible existante.
Exemple 4 : Ajoutez une ressource à la collection Move qui a une ressource cible existante. (RegionToZone)
Add-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-demo-RegionToZone" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PS-demo-RegionToZone-RG/providers/Microsoft.Network/networkinterfaces/nic_demo-RegionToZone-VM" -Name "PSDemoNIC-RegionToZone" -ExistingTargetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PS-demo-Existing/providers/Microsoft.Network/networkinterfaces/nic-demo-existing-target"
DependsOn : {}
DependsOnOverride : {}
ErrorsPropertiesCode :
ErrorsPropertiesDetail :
ErrorsPropertiesMessage :
ErrorsPropertiesTarget :
ExistingTargetId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PS-demo-Existing/providers/Microsoft.Network/networkinterfaces/nic-demo-existing-target
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-demo-RegionToZone/moveResources/PSDemoNIC-RegionToZone
IsResolveRequired : False
JobStatusJobName :
JobStatusJobProgress :
MoveStatusErrorsPropertiesCode :
MoveStatusErrorsPropertiesDetail :
MoveStatusErrorsPropertiesMessage :
MoveStatusErrorsPropertiesTarget :
MoveStatusMoveState : CommitPending
Name : PSDemoNIC-RegionToZone
ProvisioningState : Succeeded
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.ResourceSettings
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PS-demo-RegionToZone-RG/providers/Microsoft.Network/networkinterfaces/nic_demo-RegionToZone-VM
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.ResourceSettings
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
TargetId :
Type :
Ajoutez une ressource au type « RegionToZone » Move Collection qui a une ressource cible existante.
Exemple 5 : Mettez à jour les paramètres de ressource cible après l’ajout de la ressource Move. (RegionToRegion)
$moveResourceObj = Get-AzResourceMoverMoveResource -MoveCollectionName "PS-centralus-westcentralus-demoRMS1" -ResourceGroupName "RG-MoveCollection-demoRMS" -Name "PSDemoVM"
$TargetResourceSettingObj = $moveResourceObj.ResourceSetting
$TargetResourceSettingObj.TargetResourceName="PSDemoVM-target"
Update-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-centralus-westcentralus-demoRMS" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM" -Name "PSDemoVM" -ResourceSetting $TargetResourceSettingObj
DependsOn : {/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Network/networkInterfaces/psdemov
m111, /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/PSDemoRM}
DependsOnOverride : {}
ErrorsPropertiesCode :
ErrorsPropertiesDetail :
ErrorsPropertiesMessage :
ErrorsPropertiesTarget :
ExistingTargetId :
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-centralus-westcentralus-demoRMS/moveResources/PSDemoVM
IsResolveRequired : True
JobStatusJobName :
JobStatusJobProgress :
MoveStatusErrorsPropertiesCode :
MoveStatusErrorsPropertiesDetail :
MoveStatusErrorsPropertiesMessage :
MoveStatusErrorsPropertiesTarget :
MoveStatusMoveState : PreparePending
Name : PSDemoVM
ProvisioningState : Succeeded
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
TargetId :
Type :
Mettez à jour les paramètres de ressource cible après l’ajout de la ressource Move à « RegionToRegion » de type Move Collection.
Exemple 6 : Mettez à jour les paramètres de ressource cible après l’ajout de la ressource Move. (RegionToZone)
$moveResourceObj = Get-AzResourceMoverMoveResource -MoveCollectionName "PS-demo-RegionToZone" -ResourceGroupName "RG-MoveCollection-demoRMS" -Name "PSDemoVM-RegionToZone"
$TargetResourceSettingObj = $moveResourceObj.ResourceSetting
$TargetResourceSettingObj.TargetVMSize = "Standard_D4s_v3"
Update-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-centralus-westcentralus-demoRMS" -SourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PSDemoRM/providers/Microsoft.Compute/virtualMachines/PSDemoVM" -Name "PSDemoVM" -ResourceSetting $TargetResourceSettingObj
DependsOn : {}
DependsOnOverride : {}
ErrorsPropertiesCode :
ErrorsPropertiesDetail :
ErrorsPropertiesMessage :
ErrorsPropertiesTarget :
ExistingTargetId :
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-MoveCollection-demoRMS/providers/Microsoft.Migrate/moveCollections/PS-demo-RegionToZone/moveResources/PSDemoVM-RegionToZone
IsResolveRequired : False
JobStatusJobName :
JobStatusJobProgress :
MoveStatusErrorsPropertiesCode : DependencyComputationPending
MoveStatusErrorsPropertiesDetail : {Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.MoveResourceErrorBody,
Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.MoveResourceErrorBody}
MoveStatusErrorsPropertiesMessage : The dependency computation is not completed for resource - /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PS-demo-RegionToZone-RG/providers/Microsoft.Compute/virtualMachines/demo-RegionToZone-VM'.
Possible Causes: Dependency computation is pending for resource.
Recommended Action: Validate dependencies to compute the dependencies.
MoveStatusErrorsPropertiesTarget :
MoveStatusMoveState : MovePending
Name : PSDemoVM-RegionToZone
ProvisioningState : Succeeded
ResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SourceId : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/PS-demo-RegionToZone-RG/providers/Microsoft.Compute/virtualMachines/
demo-RegionToZone-VM
SourceResourceSetting : Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Models.Api20230801.VirtualMachineResourceSettings
SystemDataCreatedAt : 9/5/2023 11:13:46 AM
SystemDataCreatedBy : xxxxxxx
SystemDataCreatedByType : User
SystemDataLastModifiedAt : 9/5/2023 11:13:46 AM
SystemDataLastModifiedBy : xxxxxxx
SystemDataLastModifiedByType : User
TargetId :
Type :
Mettez à jour les paramètres de ressource cible après l’ajout de la ressource Move à « RegionToZone » type Move Collection.
Paramètres
-AsJob
Exécuter la commande en tant que travail
Type: | SwitchParameter |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-Confirm
Vous invite à confirmer avant d’exécuter l’applet de commande.
Type: | SwitchParameter |
Alias: | cf |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-DefaultProfile
Le paramètre DefaultProfile n’est pas fonctionnel. Utilisez le paramètre SubscriptionId lorsqu’il est disponible si vous exécutez l’applet de commande sur un autre abonnement.
Type: | PSObject |
Alias: | AzureRMContext, AzureCredential |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-DependsOnOverride
Obtient ou définit les remplacements des dépendances de ressources de déplacement. Pour construire, consultez la section NOTES pour les propriétés DEPENDSONOVERRIDE et créer une table de hachage.
Type: | IMoveResourceDependencyOverride[] |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-ExistingTargetId
Obtient ou définit l’ID ARM cible existant de la ressource.
Type: | String |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-MoveCollectionName
Nom de la collection Move.
Type: | String |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | True |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-Name
Nom de la ressource Déplacer.
Type: | String |
Alias: | MoveResourceName |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | True |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-NoWait
Exécuter la commande de manière asynchrone
Type: | SwitchParameter |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-ResourceGroupName
Nom du groupe de ressources.
Type: | String |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | True |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-ResourceSetting
Obtient ou définit les paramètres de ressource. Pour construire, consultez la section NOTES pour les propriétés RESOURCESETTING et créez une table de hachage.
Type: | IResourceSettings |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-SourceId
Obtient ou définit l’ID ARM source de la ressource.
Type: | String |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-SubscriptionId
ID d’abonnement.
Type: | String |
Position: | Named |
Valeur par défaut: | (Get-AzContext).Subscription.Id |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
-WhatIf
Affiche ce qui se passerait si l’applet de commande s’exécute. L’applet de commande n’est pas exécutée.
Type: | SwitchParameter |
Alias: | wi |
Position: | Named |
Valeur par défaut: | None |
Obligatoire: | False |
Accepter l'entrée de pipeline: | False |
Accepter les caractères génériques: | False |
Sorties
Notes
ALIAS
Update-AzResourceMoverMoveResource