[英]How to pass Json variable to command line task in Azure DevOps pipeline?
[英]How can I pass a variable to the SqlAzureDacpacDeployment@1 task in azure devops pipeline
我正在嘗試讓應用程序訪問數據庫。 其中一個步驟要求必須在數據庫上運行創建用戶的腳本。 我通過 azureSqlAzureDacpacDeployment@1 任務的管道執行此操作。
- task: SqlAzureDacpacDeployment@1
inputs:
azureSubscription: 'xxxxxxxx (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)'
AuthenticationType: 'aadAuthenticationIntegrated'
ServerName: '$(SqlServerName)'
DatabaseName: '$(SqlDatabaseName)'
deployType: 'InlineSqlTask'
SqlInline: |
CREATE USER [$(AppName)] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datareader ADD MEMBER [$(AppName)];
ALTER ROLE db_datawriter ADD MEMBER [$(AppName)];
GO
InlineAdditionalArguments: '-v $(ApiAppName)'
IpDetectionMethod: 'AutoDetect'
ApiAppName = 'AppName=MyApplication'
##[error]The format used to define the new variable for Invoke-Sqlcmd cmdlet is invalid.
Please use the 'var=value' format for defining a new variable.Check out how to troubleshoot
failures at https://aka.ms/sqlazuredeployreadme#troubleshooting-
您似乎正在嘗試在 SQL 腳本中定義變量。 您可以嘗試DECLARE
語句和SET
語句,如下鏈接所示:
-- Declare two variables.
DECLARE @AppName nvarchar(50);
-- Set their values.
SET @AppName = 'MyApplication';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.