Skip to content

SecretClient.list_properties_of_secrets() nextlink URL does not match the original vault URL provided to the secret client #29940

Open
@krissmilne

Description

  • Package Name: azure.keyvault.secrets.SecretClient
  • Package Version: 4.7.0
  • Operating System: Amazon Linux 2
  • Python Version: 3.8.16

Describe the bug
When constructing the SecretClient with a custom domain name for the Azure Vault URL and calling list_properties_of_secrets() method, the nextlink for the ItemPaged iterator returns the default public Vault URL.

This causes subsequent iterations to fail.

To Reproduce

  1. Connecting to Azure Key Vault using a Private Endpoint with an Azure Application Gateway
    • The problem may also exist if just using a Private Endpoint without Azure Application Gateway
  2. Custom DNS record resolves to the front end of the Azure Application Gateway
  3. Construct the SecretClient with the vault_url set to the URL of the Application Gateway
  4. Call SecretClient.list_properties_of_secrets()
  5. If the number of secrets exceeds the page and a nextlink is returned for the ItemPaged iterator, the nextlink is set to the public URL of the Key Vault
  6. The next API calls to Key Vault Secrets uses the public vault URL

Expected behavior
The nextlink URL should match the FQDN of the original vault_url supplied to the SecretClient

Verbose Logs Output
18/04/2023 07:45:06: DEBUG: https://my-example-key-vault.custom.domain.name:443 "GET /secrets?api-version=7.4 HTTP/1.1" 200 6307

18/04/2023 07:45:06: INFO: Response status: 200
Response headers:
'Date': 'Tue, 18 Apr 2023 07:45:06 GMT'
'Content-Type': 'application/json; charset=utf-8'
'Content-Length': '6307'
'Connection': 'keep-alive'
'Cache-Control': 'no-cache'
'Pragma': 'no-cache'
'Expires': '-1'
'x-ms-keyvault-region': 'eastasia'
'x-ms-client-request-id': 'REDACTED'
'x-ms-request-id': 'REDACTED'
'x-ms-keyvault-service-version': '1.9.775.1'
'x-ms-keyvault-network-info': 'conn_type=PrivateLink;private_endpoint=/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Network/privateEndpoints/REDACTED;addr=REDACTED;act_addr_fam=InterNetworkV6;'
'X-Content-Type-Options': 'REDACTED'
'Strict-Transport-Security': 'REDACTED'

18/04/2023 07:45:06: DEBUG: Response status: '200'
Response headers:
'Date': 'Tue, 18 Apr 2023 07:45:06 GMT'
'Content-Type': 'application/json; charset=utf-8'
'Content-Length': '6307'
'Connection': 'keep-alive'
'Cache-Control': 'no-cache'
'Pragma': 'no-cache'
'Expires': '-1'
'x-ms-keyvault-region': 'eastasia'
'x-ms-client-request-id': 'REDACTED'
'x-ms-request-id': 'REDACTED'
'x-ms-keyvault-service-version': '1.9.775.1'
'x-ms-keyvault-network-info': 'conn_type=PrivateLink;private_endpoint=/subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Network/privateEndpoints/REDACTED;addr=REDACTED;act_addr_fam=InterNetworkV6;'
'X-Content-Type-Options': 'nosniff'
'Strict-Transport-Security': 'max-age=31536000;includeSubDomains'
Response content:
{"value":[REDACTED],"nextLink":"https://REDACTED.vault.azure.net:443/secrets?api-version=7.4&$skiptoken=REDACTED"}

18/04/2023 07:45:06: DEBUG: Request URL: 'https://REDACTED.azure.net:443/secrets?api-version=7.4&$skiptoken=REDACTED'
Request method: 'GET'
Request headers:
'x-ms-client-request-id': 'REDACTED'
'User-Agent': 'azsdk-python-keyvault-secrets/4.7.0 Python/3.8.16 (Linux-4.14.296-222.539.amzn2.x86_64-x86_64-with-glibc2.2.5)'
Request body:
This request has no body

18/04/2023 07:45:06: INFO: Request URL: 'https://REDACTED.vault.azure.net:443/secrets?api-version=REDACTED&$skiptoken=REDACTED'
Request method: 'GET'
Request headers:
'x-ms-client-request-id': 'REDACTED'
'User-Agent': 'azsdk-python-keyvault-secrets/4.7.0 Python/3.8.16 (Linux-4.14.296-222.539.amzn2.x86_64-x86_64-with-glibc2.2.5)'
No body was attached to the request

18/04/2023 07:45:06: DEBUG: Starting new HTTPS connection (1): REDACTED.vault.azure.net:443

18/04/2023 07:47:15: DEBUG: Request URL: 'https://REDACTED.vault.azure.net:443/secrets?api-version=7.4&$skiptoken=REDACTED'
Request method: 'GET'
Request headers:
'x-ms-client-request-id': 'REDACTED'
'User-Agent': 'azsdk-python-keyvault-secrets/4.7.0 Python/3.8.16 (Linux-4.14.296-222.539.amzn2.x86_64-x86_64-with-glibc2.2.5)'
Request body:
This request has no body

18/04/2023 07:47:15: INFO: Request URL: 'https://REDACTED.vault.azure.net:443/secrets?api-version=REDACTED&$skiptoken=REDACTED'
Request method: 'GET'
Request headers:
'x-ms-client-request-id': 'REDACTED'
'User-Agent': 'azsdk-python-keyvault-secrets/4.7.0 Python/3.8.16 (Linux-4.14.296-222.539.amzn2.x86_64-x86_64-with-glibc2.2.5)'
No body was attached to the request

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.KeyVaultcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-requestThis issue requires a new behavior in the product in order be resolved.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

  • Status

    Not Started

Relationships

None yet

Development

No branches or pull requests

Issue actions