Using getSecret() to retrieve a secret value from KeyVault in Gov cloud

natalie 6 Reputation points Microsoft Employee
2023-01-25T00:47:34.4733333+00:00

For public cloud we are using getSecret(akvName: String, secret: String, linkedService: String) to get a secret from keyvault. However, as we are setting up our government cloud, the host this uses is the public cloud<keyvault>.vault.azure.net instead of using the government cloud of .us . How can I get the secret in government cloud for a government cloud keyvault. I verfied that the Linked Service base url was government cloud as well.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,107 questions
{count} votes

2 answers

Sort by: Most helpful
  1. BhargavaGunnam-MSFT 23,586 Reputation points Microsoft Employee
    2023-01-25T20:39:34.04+00:00

    Hello @natalie,

    Welcome to the MS Q&A platform.

    The hostname for Key Vault in Azure Government Cloud is vault.usgovcloudapi.net

    This is documented here: https://learn.microsoft.com/en-us/azure/azure-government/compare-azure-government-global-azure

    User's image

    I hope this helps.

    If this answers your question, please consider accepting the answer by hitting the Accept answer and up-vote as it helps the community.

    1 person found this answer helpful.

  2. natalie 6 Reputation points Microsoft Employee
    2023-01-26T19:13:29.4266667+00:00

    GetSecret() defaults to using the public host for the keyvault therefore you'll need to pass in the full domain for the vault name for the respective env.
    Gov cloud:

    vault.usgovcloudapi.net
    

    i.e.

    import com.microsoft.azure.synapse.tokenlibrary.TokenLibrary

    val connectionString: String = TokenLibrary.getSecret("<yourKVName>.vault.usgovcloudapi.net", "<yourSecretName>", "<YourLinkedService>")

    1 person found this answer helpful.
    0 comments No comments