Configure error and feature reporting on Azure Pipelines
Published 17 October 2019
In this document you will learn how to configure error reporting and feature usage reporting for SmartAssembly running on Microsoft-hosted Azure build agents.
Afterwards you will be able to download and view error reports on your local machine, while building the assemblies on Azure Pipelines.
Prerequisites
Before following this instruction you should have SmartAssembly already installed in your Azure Pipeline (see Using SmartAssembly with Azure Pipelines).
You also must have an SQL database created and configured (see Configure database connection on Azure Pipelines).
Prepare Azure File Share for hosting map files
If you don't have it already, you need to create an Azure File Share to allow SmartAssembly to store the map files.
Map files are required to convert obfuscated information within an error report back to meaningful names. You can learn more in About map files document.
You can learn how to create an Azure File Share in Create a file share in Azure Files.
Prepare the SQL database
Set the map file path
With the Azure File Share and the SQL Server ready, you must update the database to set the path to the Azure File Share folder containing the map files.
To set the map files folder connect to your database and execute the following query (remember to replace the sample values with your actual Azure File Share host and share name):
UPDATE dbo.Information SET MapFolderNetworkPath = '\\YOUR_FILE_SHARE_HOST\YOUR_FILE_SHARE_NAME'
Configuring Azure Pipelines
Option 1: Configure using the azure-pipelines.yml file
Securely storing Azure File Share credentials
- Sign-in to Azure DevOps: https://dev.azure.com/.
- From the main screen choose a project you’re working on.
- From the left-side menu choose Pipelines, then choose an existing pipeline and click Edit in the top-right corner.
- Click Variables in the top-right corner, then a button to add a new variable.
- In the Name field type SA_FS_PASSWORD. This name will later be used to set the credentials without ever disclosing the password.
- In the Value field provide your Azure File Share password.
- Check Keep this value secret to prevent the password to be shown in Azure GUI and build logs (it will be replaced with ***).
- Click OK.
Apply credentials for Azure File Share
To allow the build agent to access your Azure File Share, you have to add appropriate credentials to the credential storage.
Add the following task after previously added SmartAssembly.settings task.
- task: PowerShell@2 displayName: 'Set Azure File Share credentials' inputs: targetType: 'inline' script: | ######################## $fileShareHost = "YOUR_FILE_SHARE_HOST"; # replace with host of your Azure File Share server $fileShareUser = "YOUR_FILE_SHARE_USER"; # replace with your Azure File Share username ######################## $fileSharePass = "$(SA_FS_PASSWORD)"; Invoke-Expression -Command "cmdkey /add:$fileShareHost /user:$fileShareUser /pass:$fileSharePass"
Option 2: Configure using the classic editor (without YAML)
Securely storing Azure File Share credentials
- Sign-in to Azure DevOps: https://dev.azure.com/.
- From the main screen choose a project you’re working on.
- From the left-side menu choose Pipelines, then choose an existing pipeline and click Edit in the top-right corner.
- Go to Variables tab and make sure Pipeline variables tab is selected on the left-side menu.
- Click Add button below the variables table.
- In the Name column type SA_FS_PASSWORD. This name will later be used to set the credentials without ever disclosing the password.
- In the Value column provide your Azure File Share password.
- Click on the padlock icon on the right side of the Value column to change variable type to secret, preventing the password to be shown in Azure GUI and build logs (it will be replaced with ***).
- Click Save button located on a toolbar above the variables table.
Apply credentials for Azure File Share
- On the pipeline edit screen make go to Tasks tab.
- From the list on the left-side of the screen select an agent job responsible for building your project.
- Click on the icon next to the agent job's name.
- Search for PowerShell task, then click Add button. The task will now be added to the tasks list as PowerShell Script.
- Drag the PowerShell Script task and drop it after previously added SmartAssembly.settings.
- With the task selected, change its Name to Set Azure File Share credentials.
- Change the Type to Inline.
In the Script field, paste the following PowerShell script:
######################## $fileShareHost = "YOUR_FILESHARE_HOST"; # replace with host of your Azure File Share server $fileShareUser = "YOUR_FILESHARE_USER"; # replace with your Azure File Share username ######################## $fileSharePass = "$(SA_FS_PASSWORD)"; Invoke-Expression -Command "cmdkey /add:$fileShareHost /user:$fileShareUser /pass:$fileSharePass"
- Click Save button located on a toolbar above the tasks list.