azure - 关于 cmdlet 'Get-AzKeyVaultSecret' SecretValueText 中的重大更改的警告已弃用 Az4.6.1
问题描述
我今天将 Az Powershell 升级到 4.6.1 并开始看到以下警告。我的问题是我应该如何处理这个警告?我可以将警告静音,但这根本无法帮助我为这种重大变化做好准备。我检查了 Az 4.6.1 Microsoft 文档,他们告诉我我应该仍然使用 SecretValueText,并且没有提供关于弃用或任何其他获取秘密值的方法的类似警告。那么使用 SecretValueText 读取 KeyVault 机密的 powershell 的更新路径是什么?
WARNING: Breaking changes in the cmdlet 'Get-AzKeyVaultSecret' :
WARNING: - "The output type 'Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret' is changing"
- The following properties in the output type are being deprecated :
'SecretValueText'
WARNING: Note :The change is expected to take effect from the version : '3.0.0'
WARNING: - "The output type 'Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultSecret' is changing"
- The following properties in the output type are being deprecated :
'SecretValueText'
WARNING: Note :The change is expected to take effect from the version : '3.0.0'
WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
这是Microsoft 文档中的当前示例:
$secret = Get-AzKeyVaultSecret -VaultName 'Contoso' -Name 'ITSecret'
Write-Host "Secret Value is:" $secret.SecretValueText
Secret Value is: P@ssw0rd
解决方案
这可以通过以下方式完成:
通过以下方式获取秘密:
$secret = Get-AzKeyVaultSecret -VaultName {YourVaultName} -Name {YourSecret}
$pass = $secret.SecretValue | ConvertFrom-SecureString -AsPlainText
这与 $secret.SecretValueText 相同
推荐阅读
- php - Wocomerce 不允许我为我的产品使用外部图片
- quill - 未捕获的 ReferenceError:未定义 Quill
- node.js - 如何在mongodb中查询具有多个引用数组的文档?
- django - 我正在使用 pinax-referral 但是当我跟进时,我得到了 raise.self.model.DoesNotExist 以及无法配置记录器的值错误
- python-3.x - 比较字典和数据框中的值
- tensorflow - 如何使用 TensorFlow C API 从字符串张量中提取字符串?
- html - Typed.js 不适用于多个实例
- python - python asyncio通过回调函数获取数据
- gcc - 如何使 Python3 解释器更快或最快?
- c# - 如何编写将实现名称与它们实现的接口相关联的自定义属性?