public async void DeployWithSqlCmdVariables() { var result = GetLiveAutoCompleteTestObjects(); SqlTestDb sourceDb = await SqlTestDb.CreateNewAsync(TestServerType.OnPrem, query : storedProcScript, dbNamePrefix : "DacFxDeploySqlCmdVarsTest"); SqlTestDb targetDb = null; try { DacFxService service = new DacFxService(); // First extract a db to have a dacpac to deploy later string dacpacPath = InitialExtract(service, sourceDb, result); // Deploy the created dacpac with SqlCmdVars var deployParams = new DeployParams { PackageFilePath = dacpacPath, DatabaseName = string.Concat(sourceDb.DatabaseName, "-deployed"), UpgradeExisting = false, SqlCommandVariableValues = new Dictionary <string, string>() { { databaseRefVarName, "OtherDatabase" }, { filterValueVarName, "Employee" } } }; DeployOperation deployOperation = new DeployOperation(deployParams, result.ConnectionInfo); service.PerformOperation(deployOperation, TaskExecutionMode.Execute); targetDb = SqlTestDb.CreateFromExisting(deployParams.DatabaseName); string deployedProc; using (SqlConnection conn = new SqlConnection(targetDb.ConnectionString)) { try { await conn.OpenAsync(); deployedProc = (string)ReliableConnectionHelper.ExecuteScalar(conn, "SELECT OBJECT_DEFINITION (OBJECT_ID(N'Procedure1'));"); } finally { conn.Close(); } } Assert.Contains(deployParams.SqlCommandVariableValues[databaseRefVarName], deployedProc); Assert.Contains(deployParams.SqlCommandVariableValues[filterValueVarName], deployedProc); VerifyAndCleanup(dacpacPath); } finally { sourceDb.Cleanup(); if (targetDb != null) { targetDb.Cleanup(); } } }