Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az keyvault purge --name "{name}" hangs forever, despite key vault being successfully purged #30333

Open
VladMoglan-eaton opened this issue Nov 13, 2024 · 3 comments
Assignees
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault az keyvault question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@VladMoglan-eaton
Copy link

Describe the bug

We have a PowerShell script to create an Azure key vault in a disposable environment. In the beginning of the script, we are checking if a soft-deleted key vault exists that has the same name as the key vault we're trying to create — if it does, we purge it:

$DeletedKeyVaults = az keyvault list-deleted --query "[].name" -o json | ConvertFrom-Json

if($KeyVaultName -in $DeletedKeyVaults)
{
    Write-Host "Purging key vault '$KeyVaultName'..."
    az keyvault purge --name $KeyVaultName --location $ResourceGroupLocation
    Write-Host "Key vault '$KeyVaultName' was purged."
}

While every Azure CLI command in the script runs and successfully returns after a while, the az keyvault purge command hangs seemingly forever ("Running" is displayed on the console). The command does what it's supposed to be doing since, when checking the Azure portal, the key vault that was supposed to be purged is indeed purged as a result of running the command. It's just that the command never returns, thus allowing the script to continue.

Running the command with --debug reveals the fact that a certain request is being made in a loop, always resulting in a response with status code 202 Accepted (see debug output below).

Related command

az keyvault purge --name '{name}'
az keyvault purge --name '{name}' --location '{location}'

Errors

There are no errors.

Issue script & Debug output

While the command hangs indefinitely, the following sections are printed to the output at short intervals:

  • Request
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '<REDACTED>'
cli.azure.cli.core.sdk.policies:     'CommandName': 'keyvault purge'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--name --location --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.58.0 (MSI) azsdk-python-core/1.28.0 Python/3.11.7 (Windows-10-10.0.22631-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
  • Response
cli.azure.cli.core.sdk.policies: Response status: 202
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies:     'Content-Length': '64'
cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies:     'Expires': '-1'

Expected behavior

The command purges the key vault it needs to purge and resumes the script execution.

Environment Summary

azure-cli 2.58.0

core 2.58.0
telemetry 1.1.0

Dependencies:
msal 1.26.0
azure-mgmt-resource 23.1.0b2

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users<REDACTED>.azure\cliextensions'

Python (Windows) 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

This runs on a self-hosted build agent as part of a deployment pipeline and exhibits the same behavior.

@VladMoglan-eaton VladMoglan-eaton added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 13, 2024
Copy link

Hi @VladMoglan-eaton,

2.58.0 is not the latest Azure CLI(2.66.0).

If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.

@azure-client-tools-bot-prd azure-client-tools-bot-prd bot added the Auto-Resolve Auto resolve by bot label Nov 13, 2024
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 13, 2024

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot KeyVault az keyvault labels Nov 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 13, 2024
@VladMoglan-eaton
Copy link
Author

Updated to latest Azure CLI version 2.66.0, issue persists.

@yonzhan yonzhan removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 13, 2024
@yonzhan yonzhan added this to the Backlog milestone Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot Auto-Resolve Auto resolve by bot Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. KeyVault az keyvault question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants