Search code examples
azure-devopsmaster-data-services

CICD for MDS via Azure Devops


I am trying to implement CICD for MDS via Azure Devops. Below are the steps which I have followed :

  1. Created a self hosted agent which has SSDT installed
  2. Tried executing the MDS Cmd queries from the VM which I created as a self hosted agent and it was a success :

enter image description here

  1. In Azure Devops, used the self hosted agent and CMD task:

enter image description here

And added the inline query :

cd C:\Program Files\Microsoft SQL Server\110\Master Data Services\Configuration

MDSModelDeploy createpackage -service MDS1 -model SalesBI -package "C:\MDS\CICD\SalesBI_CICD.pkg" 

And after execution of the pipeline, I am getting the error :

The web configuration file for the Master Data Services instance cannot be loaded. An error occurred loading a configuration file: Access to the path 'C:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication\web.config' is denied. (C:\Program Files\Microsoft SQL Server\110\Master Data Services\WebApplication\web.config)

So is there anything which I am missing out while setting up the self hosted agent in Devops because executing the same commands by manually logging into the same VM is getting executed successfully.


Solution

  • In the Azure DevOps, If you want to access local file in the azure devops pipeline via self-hosted agent, It accesses the file via service account instead of Personal account, so you can run the cmd locally from your computer, and get error in the azure devops pipeline.

    Workaround

    We could open check the file permission and configure the service account permission. service account format User/Administrator/Administrators({Agent.ComputerName}\User/Administrator/Administrators)

    Also, we could change the agent service account to your owner account.

    Steps: Open service on the agent machine and search the agent service account, check the pic below, just change the account name and password to yours, then It will use this account to perform the operation.

    enter image description here