首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从CustomScriptExtension调用sql-server-express在Azure中失败

从CustomScriptExtension调用sql-server-express在Azure中失败
EN

Server Fault用户
提问于 2019-11-04 22:38:00
回答 1查看 415关注 0票数 0

我正在尝试引导一个新的Azure VM,所以我正在安装巧克力,并使用它来安装包。不幸的是,我在巧克力日志中得到了错误的The system cannot find the file specified,尽管包已经下载好了。

我怎么才能解决这个问题?

EN

回答 1

Server Fault用户

发布于 2019-11-04 22:38:00

该错误似乎与Azure启动CustomScriptExtensions的帐户有关。

我设法使用Powershell作为管理用户运行安装:

代码语言:javascript
复制
Enable-WSManCredSSP -Role Server -Force
Enable-WSManCredSSP -Role Client -DelegateComputer * -Force
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation -Name AllowFreshCredentialsWhenNTLMOnly -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\CredentialsDelegation\AllowFreshCredentialsWhenNTLMOnly -Name 1 -Value * -PropertyType String
Set-Item -Path "WSMan:\localhost\Service\Auth\CredSSP" -Value $true
$securePassword = ConvertTo-SecureString 'passwordgoeshere' -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential 'hostname\adminuser', $securePassword
Invoke-Command -Authentication CredSSP -ScriptBlock {choco install sql-server-express} -ComputerName hostname -Credential $credential

请注意,您必须同时提供凭据(即hostname\adminuser)的主机名和用户名,否则该命令将无法从CustomScriptExtension中运行。

您还需要使用CredSSP,否则安装将失败,错误如下:

代码语言:javascript
复制
Exception type: Microsoft.SqlServer.Chainer.Infrastructure.ChainerInfrastructureException
    Message: 
        There was an error generating the XML document.
    HResult : 0x84b10001
        FacilityCode : 1201 (4b1)
        ErrorCode : 1 (0001)
    Data: 
      DisableWatson = true
    Stack: 
        at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
        at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(Object objectToSerialize)
        at Microsoft.SqlServer.Chainer.Infrastructure.PublicConfigurationBridge.Calculate()
        at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateSettings(IEnumerable`1 settingIds)
        at Microsoft.SqlServer.Chainer.Infrastructure.InputSettingService.CalculateAllSettings(Boolean chainerSettingOnly)
        at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
        at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.<>c__DisplayClasse.b__b()
        at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(ActionWorker workerDelegate)
    Inner exception type: System.InvalidOperationException
        Message: 
                There was an error generating the XML document.
        HResult : 0x80131509
        Stack: 
                at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
                at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
                at Microsoft.SqlServer.Chainer.Infrastructure.DataStoreService.SerializeObject(String rootPath, Object objectToSerialize, Boolean saveToCache)
        Inner exception type: System.Security.Cryptography.CryptographicException
            Message: 
                        Access is denied.

            HResult : 0x80070005
            Stack: 
                        at System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope)
                        at Microsoft.SqlServer.Common.SqlSecureString.WriteXml(XmlWriter writer)
                        at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
                        at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write6_AgentConfigurationPublic(String n, String ns, AgentConfigurationPublic o, Boolean isNullable, Boolean needType)
                        at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterAgentConfigurationPublic.Write7_AgentConfigurationPublic(Object o)

有关启用https://stackoverflow.com/a/48571976/157605的详细信息,请参阅CredSSP。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/990575

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档