Azure Key Vault integration with ServiceNow External Credential Store – Common setup issues, root causes, and resolutionsIssue <!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Credentials stored in Azure Key Vault fail during Test Credential and/or Discovery when resolved by the MID Server. Typical errors include Azure parameters showing as null, socket resets to *.vault.azure.net:443, or secret JSON mismatches that lead to invalid username/credential parsing. Symptoms<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Test of a credential configured with External credential store = Azure Key Vault fails. MID logs show one or more of: AzureAccessTokenManager - getTokenWithSecretKey ... tenantId=null, clientId=null MID Server is hosted outside of Azure cloud. Please check your Azure credential configuration in MID Server read ECONNRESET / socket exception to https://<vault>.vault.azure.net Errors indicating an invalid or missing username/secret derived from the retrieved JSON After correcting setup (config + network + JSON + mapping), external-store credentials test successful and Discovery proceeds. Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Any release Cause<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } - MID parameters added but MID not restarted → values remain null in logs (e.g., tenantId=null, clientId=null). - Incorrect or missing config.xml parameters (for MID hosted outside Azure): ext.cred.azure.tenant_id,ext.cred.azure.client_id,ext.cred.azure.secret_key,ext.cred.azure.vault_name - Network/TLS egress blocked from MID to *.vault.azure.net:443 (or SSL interception/proxy breakage) → ECONNRESET/socket errors. - Credential ID mapping in the ServiceNow credential record is incorrect (e.g., using only <secret_name> when vault_name is not set in config.xml). - Secret JSON schema in Key Vault does not match what the selected credential type expects (missing required keys, malformed PEM/string, wrong type, etc.). Resolution<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Perform steps in order: 1. Configure MID (Outside Azure Only) Steps: Edit the agent/config.xml file on the MID host.(Parameter names are case- and dot-sensitive.)<parameter name="ext.cred.azure.vault_name" secure="false" value="<azure_key_vault_name>"/> <!-- optional --><parameter name="ext.cred.azure.tenant_id" secure="true" value="<tenant_id>"/><parameter name="ext.cred.azure.client_id" secure="true" value="<client_id>"/><parameter name="ext.cred.azure.secret_key" secure="true" value="<client_secret>"/> Important: Restart the MID Server service after saving the file. Validation: The next MID log entries should show:tenantId=<guid> and clientId=<guid> (not null). Note: If the MID is not restarted after adding or changing parameters, the logs will continue to show tenantId=null, clientId=null. 2. Configure MID (Inside Azure Only) Steps: Use Managed Identity (system- or user-assigned) on the MID host. Grant the identity Get (and optionally List) Secret permissions on the Key Vault. No client secret parameters are required in config.xml. Validation: The MID logs should show successful token retrieval without using a client secret. 3. Allow Outbound Network Access Steps: Allow outbound HTTPS (443) from the MID host to: *.vault.azure.net Azure AD login endpoint (e.g., login.microsoftonline.com). If a proxy is used, configure the MID to use it and ensure the proxy can reach these endpoints. Quick Check: From the MID host, a Postman or curl “GET secret” command should succeed (no ECONNRESET). 4. Set Correct Credential ID in ServiceNow Steps: Open the credential record where External credential store = Azure Key Vault. Use the appropriate format for the Credential ID: ConditionCredential ID Formatext.cred.azure.vault_name is set in config.xml<secret_name>ext.cred.azure.vault_name is not set<secret_name>:<azure_key_vault_name> 5. Store Secret in Correct JSON Format Use these examples as a guide (actual fields depend on credential type): Example 1 – Username/Password { "type": "<type_for_username_password>", "user": "<user_value>", "password": "<password_value>" } Example 2 – Key-Based Authentication { "type": "<type_for_key_based_auth>", "user": "<user_value>", "private_key": "<PEM or key content>", "passphrase": "" } Tips: -Ensure valid JSON (no hidden or special characters). -Preserve line breaks in PEM or key content. -Include all required fields for the credential type. 6. Re-Test and Validate Steps: -Use Test Credential → expected result: Success. -Re-run Discovery using the same credential. -Verify in MID logs that authentication succeeds. Common Errors and Quick Fixes SymptomRoot CauseActiontenantId=null, clientId=nullMID not restarted after config changesRestart MID Serverread ECONNRESET to vault.azure.net:443Network or proxy blocking HTTPSAllow 443 and disable SSL inspectionInvalid or empty username in logsIncorrect or missing JSON fieldsFix JSON in Key VaultLocal creds work, external failWrong Credential ID formatUse correct format from table above Related Links<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } MID Server Azure Key Vault integration