Ultimate PowerShell automation for VMware Cloud Foundation 9 backups

After deploying VMware Cloud Foundation (VCF) 9, configuring backups for the management components is an important step to protect your environment.

Recently, I came across an excellent blog post by Gary Blake: VMware Cloud Foundation APIs: Configure SFTP Backup Location.

In his article, Gary explains how to configure SFTP backup locations using VMware Cloud Foundation REST APIs, CURL commands, and JSON payloads.

Since I regularly use PowerShell and VMware PowerCLI for infrastructure automation, I decided to create a PowerShell version of his approach.

Why PowerShell?

PowerShell makes it easier to integrate REST API calls into existing VMware automation workflows.

Using Invoke-RestMethod, we can communicate directly with the VCF APIs, process JSON responses, handle authentication, and automate configuration tasks.

The PowerShell version follows the same API-based approach for configuring SFTP backup locations for:

• VCF Management Services
• SDDC Manager and NSX Manager
• VMware vCenter Server

The goal is to simplify the configuration process, reduce manual steps, and make it easier to reuse across multiple VCF environments. Or i my case if i need rebuilding my lab its way faster!

Download the PowerShell Script

I’ve made my PowerShell version available on GitHub.

Download the PowerShell Script – GitHub

Before running the script, make sure to review the configuration parameters and required permissions.

Final Thoughts

VMware Cloud Foundation offers powerful REST APIs for automating infrastructure management.

By converting Gary’s CURL examples into PowerShell, I hope to make SFTP backup configuration easier. With a little help from AI.

Moreover, this approach helps administrators who prefer PowerShell with VCF Backup workflows.

A big thanks to Gary Blake for the original article and inspiration!

Run-VcfSftpBackupLocation.ps1

Run-VcfSftpBackupLocation.ps1

.

# Location
switch ((get-host).Name) {
    ‘Windows PowerShell ISE Host’ { $folder = $psISE.CurrentFile.FullPath -replace ($psISE.CurrentFile.DisplayName,””) }
    ‘ConsoleHost’ { $folder = $myInvocation.MyCommand.Path -replace ($myInvocation.MyCommand.Name,””)  }
    ‘Visual Studio Code Host'{ $folder = $psEditor.GetEditorContext().CurrentFile.Path | Split-Path  }
}

Set-Location $folder

.\Set-VcfSftpBackupLocation.ps1 -Component vCenter
.\Set-VcfSftpBackupLocation.ps1 -Component SddcManager
.\Set-VcfSftpBackupLocation.ps1 -Component SddcManagerBackupSchedule
.\Set-VcfSftpBackupLocation.ps1 -Component FleetLifecycle
.\Set-VcfSftpBackupLocation.ps1 -Component FleetBackupSchedule
.\Set-VcfSftpBackupLocation.ps1 -Component All

Translate »