How to handle special characters in Azure DevOps yaml pipeline?

Viewed 28

I am using Data thirst AzDo task to create bearer token in my yaml pipeline. Reference to the task: https://marketplace.visualstudio.com/items?itemName=DataThirstLtd.databricksDeployScriptsTasks.

The SPN secret I have has special characters in it and is being passed from Azure DevOps library. The sample secret is something like this SP=X$fg#ab*a]. When I pass this value to the Azure DevOps yaml pipeline, I am getting a 403 error. My guess is, the secret value is not being parsed the right way and hence the 403. How should one handle special characters in an Azure DevOps yaml pipeline ?

My AzDo task is something like this:

 - task: DataThirstLtd.databricksDeployScriptsTasks.databricksDeployCreateBearer.databricksDeployCreateBearer@0
   displayName: 'Get Databricks Bearer Token'
   inputs:
     applicationId: '$(client_id)'
     spSecret: '$(client_secret)' #this is where the secret value is passed from AzDo library
     resourceGroup: '$(rg_name)'
     workspace: '$(adb_workspace)'
     subscriptionId: '$(subscription_id)'
     tenantId: '$(tenant_id)'
     region: '$(location)'
1 Answers

Based on my research, the variable seems been passed correctly:

enter image description here

trigger:
- none

pool:
  vmImage: windows-latest
variables:
- group: xxx
# The below setting can help check what happened.
- name: system.debug
  value: true
steps:

- task: databricksDeployCreateBearer@0
  inputs:
    applicationId: 'xxx'
    spSecret: '$(SP)'
    resourceGroup: 'xxx'
    workspace: 'xxx'
    subscriptionId: 'xxx'
    tenantId: 'xxx'
    region: 'westeurope'

Result:

enter image description here

In fact, the returned 403 code also proves that the incoming secret is correct from another aspect. Code 403 often means that the server side knows who initiated the request but rejected the request (403 Forbidden). The problem may come from insufficient AAD app permissions or restricted ip.

I suggest you take a look at this case:

Error 403 User not authorized when trying to access Azure Databricks API through Active Directory

Related