你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Set-AzAutomationCredential

修改自动化凭据。

语法

Default (默认值)

Set-AzAutomationCredential
    [-Name] <String>
    [-Description <String>]
    [-Value <PSCredential>]
    [-ResourceGroupName] <String>
    [-AutomationAccountName] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

说明

Set-AzAutomationCredential cmdlet 将凭据修改为 Azure 自动化 中的 PSCredential 对象。

示例

示例 1:更新凭据

$User = "Contoso\DChew"
$Password = ConvertTo-SecureString -String "****" -AsPlainText -Force
$Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $Password
Set-AzAutomationCredential -AutomationAccountName "Contoso17" -Name "ContosoCredential" -ResourceGroupName "ResourceGroup01" -Value $Credential

第一个命令将用户名分配给$User变量。 第二个命令使用 ConvertTo-SecureString cmdlet 将纯文本密码转换为安全字符串。 该命令将该对象存储在$Password变量中。 第三个命令基于$User和$Password创建凭据,然后将其存储在$Credential变量中。 最后一个命令修改名为 ContosoCredential 的自动化凭据,以在$Credential中使用凭据。

参数

-AutomationAccountName

指定此 cmdlet 修改凭据的自动化帐户的名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:1
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-DefaultProfile

用于与 azure 通信的凭据、帐户、租户和订阅

参数属性

类型:IAzureContextContainer
默认值:None
支持通配符:False
不显示:False
别名:AzContext, AzureRmContext, AzureCredential

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-Description

指定此 cmdlet 修改的凭据的说明。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Name

指定此 cmdlet 修改的凭据的名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:2
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-ResourceGroupName

指定此 cmdlet 修改凭据的资源组的名称。

参数属性

类型:String
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

-Value

将凭据指定为 PSCredential 对象。

参数属性

类型:PSCredential
默认值:None
支持通配符:False
不显示:False

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):True
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

String

PSCredential

输出

CredentialInfo