REST API knowledge exchange
Post Reply
Henrik.Grevelund
Service Provider
Posts: 171
Liked: 26 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Setting guestCredentials using VMware Tag as object

Post by Henrik.Grevelund »

Hi There

We use VMware Tag's to define which credentials to use in guest OS Credentials.
I would like to be able to set/change this using scripts. It's not possible using powershell.

But this new VBR API for version 11 might be. But i get an error when trying.

Getting the backup job settings returns this information:

Code: Select all

"guestCredentials": 
		{
          "credsType": "Standard",
          "credsId": "056894a1-46b2-2333-9319-20a2e07e4498",
          "credentialsPerMachine": [
            {
              "windowsCredsId": "adsd4a92-512e-42cc-bbf7-967d8d739fab",
              "linuxCredsId": "00000000-0000-0000-0000-000000000000",
              "vmObject": 
				{
                "type": "Tag",
                "hostName": "Vcenter.domain.dk",
                "name": "SQL 001",
                "objectId": "urn:vmomi:InventoryServiceTag:1449ca68-2449-44c0-84e4-0c444b6481c5:GLOBAL"
				}
			}
		}
But i try to edit the job and setting the same information i get:

Code: Select all

{
  "errorCode": "UnknownError",
  "message": "Object reference not set to an instance of an object.",
  "resourceId": null
}
Is it suppose to work ?
Have nice day,
Henrik
jhoughes
Veeam Vanguard
Posts: 282
Liked: 113 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Setting guestCredentials using VMware Tag as object

Post by jhoughes »

For one thing, you are missing a closing square bracket for the 'credentialsPerMachine' array:

Code: Select all

"guestCredentials":
{
  "credsType": "Standard",
  "credsId": "056894a1-46b2-2333-9319-20a2e07e4498",
  "credentialsPerMachine": [
    {
      "windowsCredsId": "adsd4a92-512e-42cc-bbf7-967d8d739fab",
      "linuxCredsId": "00000000-0000-0000-0000-000000000000",
      "vmObject":
        {
        "type": "Tag",
        "hostName": "Vcenter.domain.dk",
        "name": "SQL 001",
        "objectId": "urn:vmomi:InventoryServiceTag:1449ca68-2449-44c0-84e4-0c444b6481c5:GLOBAL"
        }
    }
  ]
}
Can you verify your opening/closing brackets and try again?
Husband, Father, Solutions Architect, Geek | @DenverVMUG & @DenverPSUG leader | International Speaker | Veeam Vanguard | vExpert (PRO) | Cisco Champion
Henrik.Grevelund
Service Provider
Posts: 171
Liked: 26 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Re: Setting guestCredentials using VMware Tag as object

Post by Henrik.Grevelund »

Hi Joe,

That was just a bad paste.

I tried to Get the entire job, and then set the Job with the entire delivered text. It fails with:

Code: Select all

{
  "errorCode": "UnknownError",
  "message": "Type Tag is not supported",
  "resourceId": null
}
If i use this text to set the job:

Code: Select all

{
  "isHighPriority": false,
   
  "guestProcessing": {
    "appAwareProcessing": {
      "isEnabled": true,
      "appSettings": [
        {
          "vss": "requireSuccess",
          "transactionLogs": "process",
          "vmObject": {
            "type": "Tag",
            "hostName": "Vcentername",
            "name": "Backup 003",
            "objectId": "urn:vmomi:InventoryServiceTag:9ed435f4-729f-4e06-bb78-1aaaa28ad0a3:GLOBAL"
          },
          "usePersistentGuestAgent": false,
          "sql": {
            "logsProcessing": "truncate",
            "retainLogBackups": null,
            "backupMinsCount": null,
            "keepDaysCount": null,
            "logShippingServers": null
          },
          "oracle": {
            "archiveLogs": "preserve",
            "retainLogBackups": null,
            "useGuestCredentials": true,
            "credentialsId": null,
            "deleteHoursCount": null,
            "deleteGBsCount": null,
            "backupLogs": false,
            "backupMinsCount": null,
            "keepDaysCount": null,
            "logShippingServers": null
          },
          "exclusions": {
            "exclusionPolicy": "disabled",
            "itemsList": []
          },
          "scripts": {
            "scriptProcessingMode": "disableExec",
            "windowsScripts": null,
            "linuxScripts": null
          }
        },
        {
          "vss": "requireSuccess",
          "transactionLogs": "process",
          "vmObject": {
            "type": "Tag",
            "hostName": "VCENTERname",
            "name": "SQL 001",
            "objectId": "urn:vmomi:InventoryServiceTag:1339ca68-2769-41c0-89e4-0c4aaaaa81c5:GLOBAL"
          },
          "usePersistentGuestAgent": false,
          "sql": {
            "logsProcessing": "truncate",
            "retainLogBackups": null,
            "backupMinsCount": null,
            "keepDaysCount": null,
            "logShippingServers": null
          },
          "oracle": {
            "archiveLogs": "preserve",
            "retainLogBackups": null,
            "useGuestCredentials": true,
            "credentialsId": null,
            "deleteHoursCount": null,
            "deleteGBsCount": null,
            "backupLogs": false,
            "backupMinsCount": null,
            "keepDaysCount": null,
            "logShippingServers": null
          },
          "exclusions": {
            "exclusionPolicy": "disabled",
            "itemsList": []
          },
          "scripts": {
            "scriptProcessingMode": "disableExec",
            "windowsScripts": null,
            "linuxScripts": null
          }
        }
      ]
    },
    "guestFSIndexing": {
      "isEnabled": false,
      "indexingSettings": []
    },
    "guestInteractionProxies": {
      "autoSelection": true,
      "proxyIds": []
    },
    "guestCredentials": {
      "credsType": "Standard",
      "credsId": "945ed170-6fa0-4e90-a864-c5aaaa3b1f5",
      "credentialsPerMachine": [
        {
          "windowsCredsId": "6b7c9773-d98c-40cd-a766-5aaaa9ef69ce",
          "linuxCredsId": "00000000-0000-0000-0000-000000000000",
          "vmObject": {
            "type": "Tag",
            "hostName": "Vcentername",
            "name": "SQL 001",
            "objectId": "urn:vmomi:InventoryServiceTag:1339ca68-2769-41c0-89e4-0aaaa6481c5:GLOBAL"
          }
        }
      ]
    }
  },
  
  "type": "Backup",
  "id": "171083d6-5b66-4f75-b210-3aaa05446e78",
  "name": "API test job",
  "description": "Me",
  "isDisabled": false
}
Then i get this error:

Code: Select all

{
  "errorCode": "UnknownError",
  "message": "Object reference not set to an instance of an object.",
  "resourceId": null
}
It seems like we still have the same limitations as in powershell(in V10, haven't tried V11)
Have nice day,
Henrik
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Setting guestCredentials using VMware Tag as object

Post by oleg.feoktistov » 1 person likes this post

Hi Henrik,

Reproduced it in my lab. Looks like a limitation because even the existing job cannot be re-saved with the tag creds already configured.
Raised this question with Dev/QA internally. Will keep you posted.

Thanks,
Oleg
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Setting guestCredentials using VMware Tag as object

Post by oleg.feoktistov »

Confirmed as a limitation. For that matter, added an enhancement request internally. Thanks for reporting!
Henrik.Grevelund
Service Provider
Posts: 171
Liked: 26 times
Joined: Feb 13, 2017 2:56 pm
Full Name: Henrik Grevelund
Contact:

Re: Setting guestCredentials using VMware Tag as object

Post by Henrik.Grevelund »

Hi Oleg,

I was really hoping this limitation was solved in the API.
To bad.
It will really help in scripting creation of backup jobs.
Have nice day,
Henrik
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Setting guestCredentials using VMware Tag as object

Post by oleg.feoktistov »

Agree, the plan is to add this fix in the nearest minor version release. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests