azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Unable to retrieve backup items for Azure Backup Agent (MARS)

Open asote opened this issue 7 years ago • 1 comments

Description

Documentation for PowerShell cmdlet Get-AzRecoveryServicesBackupItem (https://docs.microsoft.com/en-us/powershell/module/az.recoveryservices/get-azrecoveryservicesbackupitem?view=azps-2.4.0) states that it can be used for -BackupManagementType = MARS

Steps to reproduce

$vault = Get-AzRecoveryServicesVault
Set-AzRecoveryServicesVaultContext -Vault $vault
$container = Get-AzRecoveryServicesBackupContainer -ContainerType Windows -BackupManagementType MARS
Get-AzRecoveryServicesBackupItem -Container $container -WorkloadType ?
Get-AzRecoveryServicesBackupItem -BackupManagementType MARS -WorkloadType ?

note= parameter WorkloadType mandatory but there is no one for Windows/WindowsServer

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.16299.1146
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.1146
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

(Get-Module  -Name "Az").version
Major  Minor  Build  Revision
-----  -----  -----  --------
2      2      0      -1

Debug output

DEBUG: 2:21:33 PM - GetAzureRmRecoveryServicesBackupItem begin processing with ParameterSet 'GetItemsForContainer'.
DEBUG: 2:21:33 PM - using account id '[email protected]'...
DEBUG: Inside Restore. Going to create ResourceClient.
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: '7982b8b8-6c38-4a6a-97c0-10d3891ed994'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '7982b8b8-6c38-4a6a-97c0-10d3891ed994', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect:
 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/7982b8b8-6c38-4a6a-97c0-10d3891ed994/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: '7982b8b8-6c38-4a6a-97c0-10d3891ed994', AdEndpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2',
ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7424047Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version
'2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7424047Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version
'2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7424047Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: === Token Acquisition started:
 CacheType: null
 Authentication Target: User
 , Authority Host: login.microsoftonline.com
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7424047Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: === Token Acquisition started:
 Authority: https://login.microsoftonline.com/7982b8b8-6c38-4a6a-97c0-10d3891ed994/
 Resource: https://management.core.windows.net/
 ClientId: 1950a258-227b-4e31-a9cf-717495945fc2
 CacheType: null
 Authentication Target: User

DEBUG: [ADAL]: Verbose: 2019-07-12T19:21:33.7424047Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Verbose: 2019-07-12T19:21:33.7424047Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7435281Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 1 items to token cache.
DEBUG: [ADAL]: Verbose: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Verbose: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: 21.42135231 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: 21.42135231 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 7/12/2019 7:42:59 PM +00:00
DEBUG: [ADAL]: Information: 2019-07-12T19:21:33.7438614Z: 1a03ab94-db86-41ed-a928-1a0a1c7efc77 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 7/12/2019 7:42:59 PM
+00:00Access Token Hash: o/ehBTCc24669EH75YvZ5sjR0Ir4Iw87S3G/ppjneRo=
  User id: 8c65b959-7708-4017-9b10-5b08e8c3e83d
DEBUG: Client Created successfully
DEBUG: Caught exception, type: System.ArgumentException
DEBUG: Received ArgumentException
Get-AzRecoveryServicesBackupItem : BackupManagementType is not expected for WorkloadType: AzureVM
At line:1 char:1
+ Get-AzRecoveryServicesBackupItem -Container $containers -WorkloadType ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ArgumentException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem

DEBUG: AzureQoSEvent: CommandName - Get-AzRecoveryServicesBackupItem; IsSuccess - False; Duration - 00:00:00.1916101; Exception - System.ArgumentException: BackupManagementType is not expected for WorkloadType: AzureVM
   at Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.ProviderModel.PsBackupProviderManager.GetProviderInstance(WorkloadType workloadType, Nullable`1 backupManagementType)
   at Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem.<ExecuteCmdlet>b__31_0()
   at Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.RecoveryServicesBackupCmdletBase.ExecutionBlock(Action action, Boolean shouldProcess);
DEBUG: Finish sending metric.
DEBUG: 2:21:34 PM - GetAzureRmRecoveryServicesBackupItem end processing.
DEBUG: 2:21:34 PM - GetAzureRmRecoveryServicesBackupItem end processing.

--------------------------------------------------------------------------------------------
Get-AzRecoveryServicesBackupItem -Container $containers -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:71
+ ... ServicesBackupItem -Container $containers -WorkloadType WindowsServer
+                                                             ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem

----------------------------------------------------------------------------------------------
Get-AzRecoveryServicesBackupItem : Cannot bind parameter 'WorkloadType'. Cannot convert value "Windows" to type "Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType". Error: "Unable to match the identifier name
Windows to a valid enumerator name. Specify one of the following enumerator names and try again:
AzureVM, AzureSQLDatabase, AzureFiles, MSSQL"
At line:1 char:71
+ ... coveryServicesBackupItem -Container $containers -WorkloadType Windows
+                                                                   ~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-AzRecoveryServicesBackupItem], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.GetAzureRmRecoveryServicesBackupItem

Error output

asote avatar Jul 12 '19 19:07 asote

Get-BackupItems is not supported for Azure Backup Agent. You can only fetch containers using GetAzRecoveryServicesBackupManagementServer

siddharth7 avatar Jul 24 '19 09:07 siddharth7