使用AzureRM Powershell模块获取有关预先文件和文件夹备份的信息

时间:2018-02-23 09:04:52

标签: powershell azure-powershell azure-backup-vault

我觉得我必须做一些非常非常糟糕的事情。这些或者这些cmdlet上的文档对我来说都不够清楚。

我想要实现的目标:我想使用PS向Azure查询我们的内部部署文件和文件夹备份的状态。

我没有登录帐户的问题或获取我们的保险库列表有任何问题。当我设置保管库上下文并尝试获取有关备份作业的信息时,问题就开始了。我运行的命令:

Login-AzureRmAccount
$Vault = Get-AzureRmRecoveryServicesVault -Name VaultName
Set-AzureRmRecoveryServicesVaultContext -Vault $Vault
Get-AzureRmRecoveryServicesBackupJob -BackupManagementType MARS

最后一个命令根本不返回任何内容。但是,如果我在其上启用-Debug,它将在HTTP RESPONSE标头下显示我感兴趣的所有信息。这些信息都没有返回,调试器声明“获取的作业数:0”,我什么都没得到。

完整的调试输出:

DEBUG: 08:44:46 - GetAzureRmRecoveryServicesBackupJob begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 08:44:49 - using account id 'ACCOUNT'...
DEBUG: Inside Restore. Going to create ResourceClient.
DEBUG: [Common.Authentication]: Authenticating using Account: 'ACCOUNT', environment: 'AzureCloud', tenant: 'c2b9e5a3-3e84-41a4-9bb0-9ad0bfc0d078'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - AcquireTokenHandlerBase: === Token Acquisition started:
  Authority: https://login.microsoftonline.com/
  Resource: https://management.core.windows.net/
  ClientId: CLIENT-ID
  CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
  Authentication Target: User


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: Looking up cache for a token...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: An item matching the requested resource was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: 42.1826836416667 minutes left until token in cache expires

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: A matching item (access token or refresh token or both) was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
  Access Token Hash: 6f4Gz6d8ZDrYUvYCBBJYPmTnIndSq/HrCDh/o4NT0lk=
  Refresh Token Hash: hF89CiReJHwVRutZTWzsVTGSrcO6vmk+GTYU1Q/jxQQ=
  Expiration Time: 02/22/2018 08:27:00 +00:00
  User Hash: dt37+xi+2YPdIjxWZVMf7Xx5vD6t7he78R4CLmJoH78=


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49:  - TokenCache: Serializing token cache with 2 items.

DEBUG: Client Created successfully
DEBUG: Filters provided are: StartTime -  EndTime -  Status -  Operation -  Type - MARS
DEBUG: [Common.Authentication]: Authenticating using Account: 'ACCOUNT', environment: 'AzureCloud', tenant: 'c2b9e5a3-3e84-41a4-9bb0-9ad0bfc0d078'
DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - AcquireTokenHandlerBase: === Token Acquisition started:
  Authority: https://login.microsoftonline.com/c2b9e5a3-3e84-41a4-9bb0-9ad0bfc0d078/
  Resource: https://management.core.windows.net/
  ClientId: CLIENT-ID
  CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
  Authentication Target: User


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: Looking up cache for a token...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: An item matching the requested resource was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: 42.18256378 minutes left until token in cache expires

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: A matching item (access token or refresh token or both) was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
  Access Token Hash: 6f4Gz6d8ZDrYUvYCBBJYPmTnIndSq/HrCDh/o4NT0lk=
  Refresh Token Hash: hF89CiReJHwVRutZTWzsVTGSrcO6vmk+GTYU1Q/jxQQ=
  Expiration Time: 02/22/2018 08:27:00 +00:00
  User Hash: dt37+xi+2YPdIjxWZVMf7Xx5vD6t7he78R4CLmJoH78=


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49:  - TokenCache: Serializing token cache with 2 items.

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - AcquireTokenHandlerBase: === Token Acquisition started:
  Authority: https://login.microsoftonline.com/c2b9e5a3-3e84-41a4-9bb0-9ad0bfc0d078/
  Resource: https://management.core.windows.net/
  ClientId: CLIENT-ID
  CacheType: Microsoft.Azure.Commands.Common.Authentication.AuthenticationStoreTokenCache (2 items)
  Authentication Target: User


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: Looking up cache for a token...

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: An item matching the requested resource was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Verbose: 1 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: 42.1825471016667 minutes left until token in cache expires

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - TokenCache: A matching item (access token or refresh token or both) was found in the cache

DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49: TOKEN - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned:
  Access Token Hash: 6f4Gz6d8ZDrYUvYCBBJYPmTnIndSq/HrCDh/o4NT0lk=
  Refresh Token Hash: hF89CiReJHwVRutZTWzsVTGSrcO6vmk+GTYU1Q/jxQQ=
  Expiration Time: 02/22/2018 08:27:00 +00:00
  User Hash: dt37+xi+2YPdIjxWZVMf7Xx5vD6t7he78R4CLmJoH78=


DEBUG: Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 
DEBUG: 02/22/2018 07:44:49:  - TokenCache: Serializing token cache with 2 items.

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

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/Subscriptions/SUB-ID/resourceGroups/RSV_West-Europe/providers/Microsoft.RecoveryServices/vaults/VAULTNAME/backupJobs?$filter=operation eq '' and startTime eq '2018-02-21 07:44:49 AM' and endTime eq '20
18-02-22 07:44:49 AM'&api-version=2017-07-01

Headers:
x-ms-client-request-id        : 5bce331b-e74a-4b23-a41a-8dff4f7dd890
accept-language               : en-US

Body:

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

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-request-id               : fa17789f-af7f-44eb-99c7-8d3dfca6d676
x-ms-client-request-id        : f0a8eed2-febe-4ca6-b748-d6dc9f2b2b00-PS,f0a8eed2-febe-4ca6-b748-d6dc9f2b2b00-PS
Strict-Transport-Security     : max-age=31536000; includeSubDomains
Cache-Control                 : no-cache
Server                        : Microsoft-IIS/8.0,Microsoft-IIS/8.0
X-Powered-By                  : ASP.NET
X-Content-Type-Options        : nosniff
x-ms-ratelimit-remaining-subscription-reads: 14998
x-ms-correlation-request-id   : fa17789f-af7f-44eb-99c7-8d3dfca6d676
x-ms-routing-request-id       : WESTEUROPE:20180222T072714Z:fa17789f-af7f-44eb-99c7-8d3dfca6d676
Date                          : Thu, 22 Feb 2018 07:27:13 GMT

Body:
{
  "value": [
    {
      "id": "/Subscriptions/SUB-ID/resourceGroups/RSV_West-Europe/providers/Microsoft.RecoveryServices/vaults/VAULTNAME/backupJobs/JOB-ID",
      "name": "JOB-ID",
      "type": "Microsoft.RecoveryServices/vaults/backupJobs",
      "properties": {
        "jobType": "MabJob",
        "duration": "PT24M50.092S",
        "mabServerName": "SERVERNAME",
        "mabServerType": "MABContainer",
        "workloadType": "FileFolder",
        "errorDetails": [
          {
            "errorString": "The operation completed successfully (0x0) ",
            "recommendations": []
          }
        ],
        "entityFriendlyName": "SERVERNAME",
        "backupManagementType": "MAB",
        "operation": "Backup",
        "status": "Completed",
        "startTime": "2018-02-21T21:00:26.99Z",
        "endTime": "2018-02-21T21:25:17.082Z",
        "activityId": "ACTIVITY-ID"
      }
    }
  ]
}


DEBUG: Ignoring some of the unexpected job while conversion
DEBUG: Number of jobs fetched: 0
DEBUG: AzureQoSEvent: CommandName - Get-AzureRmRecoveryServicesBackupJob; IsSuccess - True; Duration - 00:00:07.4996067; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 08:27:15 - GetAzureRmRecoveryServicesBackupJob end processing.
DEBUG: 08:27:15 - GetAzureRmRecoveryServicesBackupJob end processing.

我是否遗漏了某些内容或者是否与提取有关内部备份的信息不兼容的cmdlet?后者会感到奇怪,因为信息显然是在我们的门户中存储和访问的,甚至可以在调试信息中返回。

0 个答案:

没有答案