Skip to content

Commit 2941472

Browse files
authored
[KeyVault] Update Az 5.0 migration guide (#14242)
* Update Az.5.0.0-migration-guide.md
1 parent c2dc522 commit 2941472

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

documentation/migration-guides/Az.5.0.0-migration-guide.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ The ability to update soft-delete setting is deprecated in Az.KeyVault 3.0.0. Re
237237
### Get-AzKeyVaultSecret
238238

239239
The property `SecretValueText` of type `Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret`
240-
has been removed. The `SecretValueText` property has been replaced with `SecretValue`.
240+
has been removed. Either apply a `-AsPlainText` to the call to get the plain text secret,
241+
or use `$secret.SecretValue` of type `SecureString` in your script.
241242

242243
#### Before
243244

@@ -249,13 +250,7 @@ $secretInPlainText = $secret.SecretValueText
249250
#### After
250251

251252
```powershell
252-
# PowerShell 7 or newer
253-
$secret = Get-AzKeyVaultSecret -VaultName myVault -Name mySecret
254-
$secretInPlainText = ConvertFrom-SecureString -SecureString $secret.SecretValue -AsPlainText
255-
256-
# Prior to PowerShell 7, or Windows PowerShell
257-
$secret = Get-AzKeyVaultSecret -VaultName myVault -Name mySecret
258-
$secretInPlainText = [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($secret.SecretValue))
253+
$secretInPlainText = Get-AzKeyVaultSecret -VaultName myVault -Name mySecret -AsPlainText
259254
```
260255

261256
## Az.ManagedServices

0 commit comments

Comments
 (0)