Failed to sync secrets via Secrets Hub to Azure Key Vault using Connector (Test the connector machine access to the Azure Key Vault)
369
Created On 11/10/26 10:57 AM - Last Modified 11/10/26 16:09 PM
Symptom
Trying to sync secrets to Azure Key Vault using Secrets Hub ended with failure:
- Configured Azure Key Vault as a target secret store in Secrets Hub, when the Key Vault is set as 'Disable public access' in Azure
- Creating a connector to provide Secrets Hub access to the Key Vault
- Adding the Key Vault as target in Secrets Hub
- Creating a sync policy to sync secrets to that target
- Got the following error in sync status:
- "Failed to test the connection. Secrets Hub does not have the required permissions on the sync target. Provide Secrets Hub with the required permissions, as described in the docs, and then try again."
Environment
N/A Privileged Access Manager (PAM, self-hosted);Privilege Cloud
- Secrets Hub working with PAM - Privilege Cloud or PAM Self-Hosted
- Azure Key Vault set as 'Disable public access' in Azure
- Connector is installed to provide Secrets Hub access to the Key Vault
Cause
It can be that the connector machine does not have access to the Key Vault:
Option#1 - Connector machine Virtual Network (VNet) is not the same as the VNet used by the Key Vault private endpoint
Option#2 - The VNet of the private DNS zone of the DNS configuration of the private endpoint used by your Key Vault is not same as the VNet of your connector machine.
Resolution
In the connector machine - run the below command. The command will check if there is a valid connection between the connector machine to your Azure Key Vault so the connector is ready for Secrets Hub.
- If the test returned that your Azure Key Vault is working in Private IP, and your Azure Key Vault is set to work with 'Disable public access';
- This is great! Your connector machine is ready to be used by Secrets Hub to sync secrets to your Azure Key Vault target.
- If the test returned that your Azure Key Vault is working in Public IP, and your Azure Key Vault is set to work with 'Disable public access'
- This means that the connector machine is accessing the Key Vault via public network and not the private network, as defined in the Key vault Networking configuration, so the connection will fail.
- The connector machine Virtual Network (VNet) should be the same as the VNet used by the Key Vault private endpoint
- You need to set the connector machine to use the same VNet as your Azure Key Vault
- You can view the Key Vault private endpoint subnet to get the right NVNet that should be used by the connector machine.
- Run the command again to test the connector connection to the Key Vault
- If the test returned that your Azure Key Vault is working in Private IP, and your Azure Key Vault is set to work with 'Disable public access' you need to:
- Make sure the VNet of the private DNS zone of the DNS configuration of the private endpoint used by your Key Vault is the same as the VNet of your connector machine/
- You can change the existing VNET or add the relevant VNET to the VNEt links of your private DNS zone.
- If the test returned that your Azure Key Vault is working in Private IP, and your Azure Key Vault is set to work with 'Disable public access';
- This is great! Your connector machine is ready to be used by Secrets Hub to sync secrets to your Azure Key Vault target.
- If the test returned that your Azure Key Vault is working in Private IP, and your Azure Key Vault is set to work with 'Disable public access' you need to:
- Another option, if your Key Vault is used with 'Allow public access from specific virtual networks and IP addresses' is to Configuring with Specific Machine IP Address
- An alternative and simpler approach is to configure the private endpoint with a specific machine IP address.
- To do this, add your virtual VNet to your machine's IP address.
- Next, include the public IP of the machine.
- Finally, run the command again to verify the Key Vault is accessed by Private IP.
function Check-PrivateIPAddress {
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[String]$IPAddress
)
$Octets = $IPAddress -split '\.'
$Octet1 = [int]$Octets[0]
if (($Octet1 -eq 10) -or ($Octet1 -eq 172 -and ([int]$Octets[1] -ge 16 -and [int]$Octets[1] -le 31)) -or ($Octet1 -eq 192 -and $Octets[1] -eq 168)) {
Write-Output "Connection to the private key vault using the IP address [$IPAddress] established successfully."
}
else {
Write-Output "Failed to establish a connection to the vault using the private connection ended with IP [$IPAddress]."
}
}
$hostName = Read-Host -Prompt "Enter the Key Vault URL: "
if ($hostName -notlike 'https://*') {
Write-Output "Invalid input. The URL must start with 'https://'."
}
else {
try {
$uri = New-Object System.Uri($hostName)
$ipAddresses = [System.Net.Dns]::GetHostAddresses($uri.Host)
foreach ($ipAddress in $ipAddresses) {
Check-PrivateIPAddress -IPAddress $ipAddress.IPAddressToString
}
}
catch {
Write-Output "Failed to establish a connection to the specified URL: $hostName"
}
}