我正在使用以下部署后脚本 1 部署 DACPAC:
ALTER DATABASE [$(DatabaseName)]
MODIFY FILE (NAME = [$(DatabaseName)],
SIZE = 100MB, MAXSIZE = UNLIMITED, FILEGROWTH = 20%)
但是,当我尝试引用此部署后脚本 2 时,部署失败:
ALTER DATABASE [$(DatabaseName)]
MODIFY FILE (NAME = [$(DatabaseName)],
SIZE = $(size), MAXSIZE = UNLIMITED, FILEGROWTH = 20%)
所以,我的问题是传递大小的正确语法是什么?
我使用此命令启动脚本(第一个 script1 有效,script2 无效)
$resourceGroup = "SQL1"
$vmName = "SQL1"
$storageName = "sql1artifactsstorage111"
$ConfigurationPath = "C:\DSC\Ext\deployDB.ps1"
$ConfigurationName = "deployDB"
$configurationArchive = "deployDB.ps1.zip"
#Publish the configuration script into user storage
Publish-AzureRmVMDscConfiguration -ConfigurationPath $ConfigurationPath -ResourceGroupName $resourceGroup -StorageAccountName $storageName -force
#Set the VM to run the DSC configuration
$configurationArguments =
@{
Credential = Get-Credential;
DatabaseName = 'Database1'
size = '100MB'
}
Set-AzureRmVmDscExtension -Version 2.22 -Name dscExtension -ResourceGroupName $resourceGroup -VMName $vmName -ArchiveStorageAccountName $storageName -ArchiveBlobName $configurationArchive -AutoUpdate:$true -ConfigurationName $ConfigurationName -ConfigurationArgument $configurationArguments
这是 DSC 显示的错误:
Dac Deploy Failed: 'Exception calling "Deploy"
with "3" argument(s): "An error occurred during deployment plan generation.
Deployment cannot continue."'