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

Get-AzDataProtectionBackupInstance only returns up to 200 backup instances

Open bwarren18 opened this issue 2 years ago • 9 comments

Description

Hello, in the Azure Portal we have > 200 backup instances in a backup vault.

We are using Get-AzDataProtectionBackupInstance to read the backup vault and check that our VM disks are protected, however it fails because the command does not return all the protected disks.

Get-AzDataProtectionBackupInstance -ResourceGroupName '<>' -VaultName '<>' -SubscriptionId '<>' | Measure-Object Returns a count of 200.

This makes the command unreliable past 200 instances.

Tested using Az.DataProtection v0.3.1 and v0.4.0

In the debug I can see the nextLink property however it seems that the cmdlet is not using it.

Issue script & Debug output

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/<redacted>/backupInstances?api-version=2022-04-01

Headers:
x-ms-unique-id                : 15
x-ms-client-request-id        : <redacted>
CommandName                   : Get-AzDataProtectionBackupInstance
FullCommandName               : Get-AzDataProtectionBackupInstance_List
ParameterSetName              : __AllParameterSets
User-Agent                    : AzurePowershell/v0.0.0,PSVersion/v5.1.19041.1682,Az.DataProtection/0.4.0

Body:



DEBUG: BeforeCall: 
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
x-ms-request-id               : 
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-resource-requests: 1988
x-ms-correlation-request-id   : 0b9116a3-d6cd-4790-9bfb-4e4c2c550325
x-ms-routing-request-id       : CANADACENTRAL:20220708T202355Z:0b9116a3-d6cd-4790-9bfb-4e4c2c550325
Cache-Control                 : no-cache
Date                          : Fri, 08 Jul 2022 20:23:54 GMT
Server                        : Microsoft-IIS/10.0
X-Powered-By                  : ASP.NET

Body:
{
  "value": [<redacted>],
  "nextLink": "https://management.azure.com/subscriptions/.../resourceGroups/.../providers/Microsoft.DataProtection/backupVaults/.../backupInstances?api-version=2022-04-01&$skiptoken=<?xml version="1.0" encoding="utf-16"?><ContinuationToken><Version>2.0</Version><Type>Table</Type><NextPartitionKey>...</NextPartitionKey><NextRowKey>...</NextRowKey><TargetLocation>Primary</TargetLocation></ContinuationToken>"
}


DEBUG: ResponseCreated: 
DEBUG: BeforeResponseDispatch: 
DEBUG: Finally: 
DEBUG: CmdletAfterAPICall: 
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd: 
DEBUG: CmdletProcessRecordEnd: 
DEBUG: AzureQoSEvent: Module: Az.DataProtection:0.4.0; CommandName: Get-AzDataProtectionBackupInstance; PSVersion: 5.1.19041.1682; IsSuccess: True; Duration: 00:00:02.7890106


Count    : 200
Average  : 
Sum      : 
Maximum  : 
Minimum  : 
Property :

Environment data

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

Module versions

ModuleType Version Name               
---------- ------- ----               
    Script 2.9.0   Az.Accounts        
    Script 4.29.0  Az.Compute         
    Script 0.4.0   Az.DataProtection  
    Script 4.6.0   Az.KeyVault        
    Script 5.4.1   Az.RecoveryServices
    Script 0.12.0  Az.ResourceGraph   
    Script 6.0.1   Az.Resources

Error output

The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

bwarren18 avatar Jul 08 '22 20:07 bwarren18

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Jul 11 '22 07:07 ghost

@bwarren18 We are looking into it and get back to you for any additional information.

SaurabhSharma-MSFT avatar Jul 13 '22 17:07 SaurabhSharma-MSFT

Thank you for your feedback. This has been routed to the support team for assistance.

ghost avatar Jul 25 '22 22:07 ghost

FYI the issue is still present using Az.DataProtection v0.5.0 .

bwarren18 avatar Oct 26 '22 19:10 bwarren18

FYI we we're able to work around this issue using Search-AzDataProtectionBackupInstanceInAzGraph instead.

bwarren18 avatar Nov 22 '22 17:11 bwarren18

@bwarren18 : It's great to know that you're unblocked on this with Search-AzDataProtectionBackupInstanceInAzGraph. Please let me know if you still need us to investigate on Get-AzDataProtectionBackupInstance command for more than 200 items.

@adityabalaji-msft FYI.

hiaga avatar Jan 19 '23 11:01 hiaga

@hiaga, the issue with 'Get-AzDataProtectionBackupInstance' only returning up to 200 objects persists with Az.DataProtection v1.2.0 and the new v2.0.0 module.

bwarren18 avatar Aug 17 '23 13:08 bwarren18

@hiaga could you please check

Daya-Patil avatar Jan 29 '24 04:01 Daya-Patil