You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure门户Run Command映射存储文件共享时遇终止符缺失错误

Azure Run Command映射存储文件共享报错:字符串缺少终止符"

我尝试通过Azure门户的Run Command功能映射Azure存储账户文件共享,执行的PowerShell脚本如下:

$storageAccountKey = 'key'
$storageAccountName = 'account'
$securePass = $storageAccountKey | ConvertTo-SecureString -AsPlainText -Force
$creds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $storageAccountName,$securePass

New-PSDrive -Credential $creds -Name Z -PSProvider FileSystem -Root '\\account.file.core.windows.net\files01' > $null

但执行后出现「字符串缺少终止符: "」错误,错误详情:

At C:\Packages\Plugins\Microsoft.CPlat.Core.RunCommandWindows\1.1.18\Downloads\script9.ps1:6 char:15
+ files01"
+        ~
The string is missing the terminator: ".
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

我已经试过用单引号、双引号、转义路径斜杠等方法,还是没找到问题根源。怀疑是不是脚本运行环境的PowerShell版本不支持?代码是从VS Code复制到浏览器的,应该是纯文本。另外,这个脚本在VM本地的PowerShell 7.4里能运行成功(前提是移除同存储账户的其他映射,不然会出现「多个连接到服务器或共享资源...」错误),想知道是不是这个问题间接导致了当前的终止符错误?

内容的提问来源于stack exchange,提问作者theillien

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 18:14:54