Closed src107 closed 9 months ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pvrk, @adityabalaji-msft.
Thanks for the feedback. I'll route this to Recovery Services team. BTW could you provide the version of PowerShell and the Az.RecoveryServices module you were using?
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pvrk, @adityabalaji-msft.
Thanks for the feedback. I'll route this to Recovery Services team. BTW could you provide the version of PowerShell and the Az.RecoveryServices module you were using?
Hi, I have added the module and powershell version in the Module Versions section
Adding @Daya-Patil to review
I am wondering on the need to initialize these classes directly, we recommend to use Get-AzRecoveryServicesBackupContainer command. It is fairly very complicated to achieve this. However if it is a hard requirement, the right way to do this is
$protectionContainerResource = [Microsoft.Azure.Management.RecoveryServices.Backup.Models.ProtectionContainerResource]::new() $protectionContainerResource.Properties = [Microsoft.Azure.Management.RecoveryServices.Backup.Models.ProtectionContainer]::new()
or AzureVmContainer/AzureStorageContainer/ AzureVMAppContainerProtectionContainer class.
$containerBase = [Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ContainerBase]::new($protectionContainerResource)
here are some code references -
1) AzureVmContainer - azure-powershell/src/RecoveryServices/RecoveryServices.Backup.Models/AzureVmModels/AzureVmContainer.cs at main · Azure/azure-powershell (github.com)
2) AzureContainer - azure-powershell/src/RecoveryServices/RecoveryServices.Backup.Models/AzureModels/AzureContainer.cs at main · Azure/azure-powershell (github.com)
3) ContainerBase - azure-powershell/src/RecoveryServices/RecoveryServices.Backup.Models/BaseObjects.cs at main · Azure/azure-powershell (github.com)
4) we first fetch the ProtectionContainerResource from .NET SDK (via service API call) and then initialize these object that customer is trying to initialize directly - azure-powershell/src/RecoveryServices/RecoveryServices.Backup.Helpers/Conversions/ConversionHelpers.cs at main · Azure/azure-powershell (github.com)
closing as have not received reply
Description
A constructor was not found. Cannot find an appropriate construc tor for type Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.ContainerBase." was thrown
Script or Debug output
Environment data
No response
Module versions
PS version - 5.1.19041.3693 Az.RecoveryServices version - 6.6.1
Error output