如何通过 Azure Windows PowerShell 命令使用 sqlpackage 命令?

问题描述 投票:0回答:1

此命令在 VM 的本地 PowerShell 中使用时成功备份数据库

&“C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe” /a:Export /ssn:<Servername> /sdn:<Servername> /su:<user> /sp:"<password>" /tf:F:\Backups\databacpac\data.bacpac

在 Azure Powershell 的上下文中应用时

az vm run-command invoke  --command-id RunPowerShellScript --name <vmname> -g <Resourcegroup> 
    --scripts '&“C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe” /a:Export /ssn:<Servername> /sdn:<Servername> /su:<user> /sp:"<password>" /tf:F:\Backups\databacpac\data.bacpac'

失败了。如何将命令成功传递给 VMPowershell?

powershell azure-powershell azure-cli sqlpackage azure-cloud-shell
1个回答
0
投票

您可以使用 Az PowerShell 在 VM 上下文中调用运行命令,方法是按照 here.

中提到的任何一种方法
© www.soinside.com 2019 - 2024. All rights reserved.