Unable to retrieve MARS backup items with Get-AzureRmRecoveryServicesBackupItem
Description
Get-AzureRmRecoveryServicesBackupItem has a required parameter -WorkloadType that only accepts AzureVM and AzureSQLDatabase. This prevents programatic access to items protected with Azure Backup agent (MARS).
Script/Steps for Reproduction
Install-Module AzureRm Import-Module AzureRm.RecoveryServices
Add-AzureRmAccount
$rmSubscription = Get-AzureRmSubscription
Set-AzureRmContext -SubscriptionId $rmSubscription.Id
$rmVault = Get-AzureRmRecoveryServicesVault
$rmContainers = Get-AzureRmRecoveryServicesBackupContainer -ContainerType Windows -BackupManagementType MARS -VaultId $rmVault.ID
Get-AzureRmRecoveryServicesBackupItem -VaultId $rmVault.ID -Container $rmContainers[0] -WorkloadType # This required parameter is where the issue happens. I cannot specify WindowsServer or MARS despite the container above accepting MARS as a BackupManagementType, so this cannot return any data.
Module Version
Get-Module -Name AzureRM -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.4.0 AzureRM
Environment Data
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.17134.112
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.112
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Debug Output
N/A, command cannot run without required -WorkloadType parameter
@dragonfly91 would you mind taking a look at this issue?
I'm in need of this as well. Does a potential work around exist?
I have just stumbled across this little issue myself and would be very greatful for a fix as we use powershell as our reporting/monitoring platform and have recently added in some VMWare servers that are being backed up into ARS.
Hi All
Please stop marking me in this email. I have got almost 2185 emails and my email account has been clogged now.
Thanks Shreya
From: Negwoh [email protected] Sent: Monday, September 17, 2018 5:02 AM To: Azure/azure-powershell [email protected] Cc: Subscribed [email protected] Subject: Re: [Azure/azure-powershell] Unable to retrieve MARS backup items with Get-AzureRmRecoveryServicesBackupItem (#6595)
I have just stumbled across this little issue myself and would be very greatful for a fix as we use powershell as our reporting/monitoring platform and have recently added in some VMWare servers that are being backed up into ARS.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-powershell%2Fissues%2F6595%23issuecomment-421852903&data=02%7C01%7Cv-shresh%40microsoft.com%7C1fce983bc6de4ccc452d08d61c2ca793%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636727375444036841&sdata=iqo6Pt8yP%2FpKREcYTh6yHkW%2B81feZmba4mIKLTEDS%2FE%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGDq4Q8gFGCeyXxIG62GnGQAwYTJUbgoks5ubt-HgaJpZM4VBmHT&data=02%7C01%7Cv-shresh%40microsoft.com%7C1fce983bc6de4ccc452d08d61c2ca793%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636727375444036841&sdata=2itImCd5Ok3U1F0SnKX%2Fi0GVYzvfd5Ikw8%2BI2yBbXjA%3D&reserved=0.
Any status on this? Having the same problem.
Get-AzureRmRecoveryServicesBackupItem -Container $MARScontainers[0]
cmdlet Get-AzRecoveryServicesBackupItem at command pipeline position 1 Supply values for the following parameters: (Type !? for Help.) WorkloadType: AzureFiles Get-AzureRmRecoveryServicesBackupItem : BackupManagementType is not expected for WorkloadType: AzureFiles At line:1 char:1
- Get-AzureRmRecoveryServicesBackupItem -Container $MARScontainers[0]
-
- CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ArgumentException
- FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem
Adding my support to this thread as the WorkloadType documentation, implementation and Intellisense seem inconsistent.
- The documentation suggests WorkloadType will accept "AzureVM", "AzureSQLDatabase" or "AzureFiles".
- When calling the command via PowerShell, asking for help at the WorkloadType prompt suggests that examples are "AzureVM" and "WindowsServer":
WorkloadType: !? Workload type of the resource (for example: AzureVM, WindowsServer). WorkloadType:
- Lastly, Intellisense suggests "AzureSQLDatabase" and "AzureVM" are the options.
I ran into this when trying to delete a vault that contained backups for a Windows Desktop. While I wasn't able to retrieve the items via the command line, I was able to find my way to the appropriate resource to delete within the Azure Portal which then allowed me to delete the vault.
Here is my SO post for anyone looking for deletion help.
Not certain why @dragonfly91 was unassigned when I made that comment. Apologies!
Is there any other way to delete individual backup recovery points other than using a script that depends on Get-AzureRmRecoveryServicesBackupItem? I followed several instructions on technet and otherwise and all seem to rely on that command. I see the other ways to delete the entire vault through the web interface as others have linked to above.
I also have this issue. Is there no fix or workaround?
10 months and still no solution?
It's irritating enough you can't do this in the frontend, but with PS failing too I'm stuck paying for data I no longer need
Also have this issue with Get-AzRecoveryServicesBackupItem.
I'm having this issue with Get-AzRecoveryServicesBackupItem. This issue is also listed here
Documentation for the Workload type is inconsistent with 3 values listed as bullet points and then the same 3 + MSSQL listed in the Accepted values table.
The module itself shows a different set of values Workload type of the resource (for example: AzureVM, WindowsServer, AzureFiles, MSSQL).
Intellisense lists: AzureFiles, AzureSQLDatabase, AzureVM, MSSQL
Example below - all containers in the list have a ContainerType of Windows and a BackupManagementType of MARS
PS C:\Users\[Redacted]> foreach ($backupContainer in $backupContainers){Get-AzRecoveryServicesBackupItem -VaultId $recoveryVault.ID -Container $backupContainer }
cmdlet Get-AzRecoveryServicesBackupItem at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
WorkloadType: AzureVM
Get-AzRecoveryServicesBackupItem : BackupManagementType is not expected for WorkloadType: AzureVM
At line:1 char:49
+ ... Containers){Get-AzRecoveryServicesBackupItem -VaultId $recoveryVault. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem
cmdlet Get-AzRecoveryServicesBackupItem at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
WorkloadType: WindowsServer
Get-AzRecoveryServicesBackupItem : Cannot bind parameter 'WorkloadType'. Cannot convert value "WindowsServer" to type
"Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType". Error: "Unable to match the identifier name WindowsServer
to a valid enumerator name. Specify one of the following enumerator names and try again:
AzureVM, AzureSQLDatabase, AzureFiles, MSSQL"
At line:1 char:49
+ ... Containers){Get-AzRecoveryServicesBackupItem -VaultId $recoveryVault. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoverySer
vicesBackupItem
cmdlet Get-AzRecoveryServicesBackupItem at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
WorkloadType: AzureFiles
Get-AzRecoveryServicesBackupItem : BackupManagementType is not expected for WorkloadType: AzureFiles
At line:1 char:49
+ ... Containers){Get-AzRecoveryServicesBackupItem -VaultId $recoveryVault. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem
cmdlet Get-AzRecoveryServicesBackupItem at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
WorkloadType: MSSQL
Get-AzRecoveryServicesBackupItem : BackupManagementType is not expected for WorkloadType: MSSQL
At line:1 char:49
+ ... Containers){Get-AzRecoveryServicesBackupItem -VaultId $recoveryVault. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem
cmdlet Get-AzRecoveryServicesBackupItem at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
WorkloadType: AzureSQLDatabase
Get-AzRecoveryServicesBackupItem : BackupManagementType is not expected for WorkloadType: AzureSQLDatabase
At line:1 char:49
+ ... Containers){Get-AzRecoveryServicesBackupItem -VaultId $recoveryVault. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ArgumentException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem
cmdlet Get-AzRecoveryServicesBackupItem at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
WorkloadType:
PS C:\Users\[Redacted]> $backupContainers.Length
45
PS C:\Users\[Redacted]> $backupContainers
FriendlyName ContainerType BackupManagementType
------------ ------------- --------------------
[Redacted name] Windows MARS
[Redacted name] Windows MARS
[Redacted name] Windows MARS
etc
Get-Module -Name Az
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 2.0.0 Az
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.1004
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.1004
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Hi everyone,
Azure Powershell Recovery services module was designed to manage primarily Azure Resources (Azure VM, Azure Files, SQL within Azure VM). For on-premise components such as MARS, MABS, DPM, an PS module is shipped along with the product (OB-Powershell) to be used. The only action possible for MARS items from the portal is unregister and hence we gave the MARS option only for Get-AzRecoveryServicesContainer. Since no actions are possible on a MARS backup item from Azure Portal/PS, trying to understand for what "Get-...BackupItem -BackupManagementType MARS" will be used for.
Hi @pvrk,
The problem lies with simply wanting to retrieve files that you store in a vault in Azure. We use Azure to backup specific files as it is 10x easier and better than what we had. We wanted to convert our disaster recovery process into accommodating Azure easily. The above thwarted us and in the end I used MS Online Backup to do what we need but this involves downloading a file every day for authentication which is nigh on useless for an automated process. Both of the modules Azure RM and AZ Recovery Services handle authentication really well but both suffer from the above problem when trying to retrieve files. I think a lot of us would appreciate it if this could be a feature put into these modules, especially as it is referenced as being able to do this.
Also I can't find this OB-Powershell module, I wanted to check if this solved my issue, could you link to any documentation for this?
@GG23x: OB is same as the MS Online module. It is documented here. Thanks for the elaboration. Now I understand that the main problem is authentication and the main use-case is restore process automation. However this requires that we integrate our on-prem products completely into Azure (Portal/PS/CLI/REST API etc) and a true central management experience from Azure for on-premise products. This is a huge feature request and which, I am sorry to say, cannot be taken up this semester (Jul-Dec, 2019). Can you please put this request in the uservoice so that it gets captured?
Closing this issue since this feature request cannot be taken up in this semester. Provided a [feedback mechanism]((https://feedback.azure.com/forums/258995-azure-backup?category_id=341221) so that it gets captured?) for users to ask and rank this feature.