Skip to content

[Feature]: Get-AzKeyVaultSecret should allow to fetch by ID #23053

@ishepherd

Description

@ishepherd

Description of the new feature

Because Key Vault secrets have a global unique ID and it's just a URL.

We tend to paste that URL around the place, e.g. in app configuration. It would be convenient if the Get-AzKeyVaultSecret supported those URLs.

What I'd like to do

Get-AzKeyVaultSecret -Id https://myvault.vault.azure.net/secrets/MySecret
Get-AzKeyVaultSecret -Id https://myvault.vault.azure.net/secrets/MySecret/03d6fd62056a4790a8982b1a75f320f8

Alternatives

$token = Get-AzAccessToken -ResourceUrl https://vault.azure.net
$headers = @{"Authorization" = "Bearer $($token.Token)"}
$response = Invoke-RestMethod -Uri https://myvault.vault.azure.net/secrets/MySecret/03d6fd62056a4790a8982b1a75f320f8?api-version=7.1 -Headers $headers

Proposed implementation details (optional)

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions