Set-AzureRmVMCustomScriptExtension SecureExecution标志不起作用

时间:2017-11-01 16:55:04

标签: powershell azure azure-powershell azure-automation

我们正在使用Set-AzureRMVMCustomScriptExtension命令针对Azure VM运行自定义PowerShell脚本。

ps脚本创建随"用户名"提供的本地用户帐户。和#34;密码"参数。

我的理解是Set-AzureRMVMCustomScriptExtension支持-SecureExecution切换,根据文档(https://docs.microsoft.com/en-us/powershell/module/azurerm.compute/set-azurermvmcustomscriptextension?view=azurermps-4.4.1&viewFallbackFrom=azurermps-4.4.0

"表示此cmdlet确保未在服务器上记录Run参数的值,或使用GET扩展API将其返回给用户。 Run的值可能包含要安全传递给脚本文件的秘密或密码。"

但是,提供交换机并执行ps脚本会导致以下内容被记录到" Windows Powershell"目标VM上的事件日志:

引擎状态从“无”更改为“可用”。

详细说明:     NewEngineState =可用     PreviousEngineState =无

SequenceNumber=13

HostName=ConsoleHost
HostVersion=5.1.14393.1770
HostId=
HostApplication=powershell -ExecutionPolicy Unrestricted -file createuser.ps1 -username myNewUser -password somePassword
EngineVersion=5.1.14393.1770
RunspaceId=
PipelineId=
CommandName=
CommandType=
ScriptName=
CommandPath=
CommandLine=

这不是我期待看到的。这是一个错误吗?或者文档不正确?

这是我执行的命令:

Set-AzureRmVMCustomScriptExtension -ResourceGroupName $ vmResourceGroupName -VMName $vmName     -StorageAccountName $ scriptStorageAccountName -ContainerName $scriptStorageAccountContainerName     -FileName $ scriptName -Run $scriptName     -Argument $ scriptArguments -Name $extensionAlias      - 位置$ location -ForceRerun $(New-Guid).Guid     -SecureExecution

1 个答案:

答案 0 :(得分:0)

嗯,它不像Azure可以神奇地改变Windows服务器的运行方式。这是Windows服务器日志记录,而不是扩展日志记录它不会将此记录到扩展日志中并将隐藏来自api的敏感信息,但很明显,powershell引擎可以像任何其他输入一样记录此输入