<p>I want to deploy a custom SQL Server image, which needs 4 environment variables passed in to AKS using the following pipeline definition:</p>
<pre><code>  jobs:
  - deployment: Deploy
    condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
    displayName: Deploy
    pool:
      vmImage: $(vmImageName)
    environment: 'xxxx.default'
    strategy:
      runOnce:
        deploy:
          steps:
          - task: KubernetesManifest@0
            displayName: Create imagePullSecret
            inputs:
              action: createSecret
              namespace: $(k8sNamespace)
              secretName: $(imagePullSecret)
              dockerRegistryEndpoint: $(dockerRegistryServiceConnection)
              
          - task: KubernetesManifest@0
            displayName: Deploy to Kubernetes cluster
            inputs:
              action: deploy
              namespace: $(k8sNamespace)
              manifests: |
                $(Pipeline.Workspace)/manifests/deployment.yml
                $(Pipeline.Workspace)/manifests/service.yml
              imagePullSecrets: |
                $(imagePullSecret)
              containers: |
                $(containerRegistry)/$(imageRepository):$(tag)
</code></pre>
<p>The manifest files are created by Azure DevOps in this instance, so how would I go along, if I wanted to inject the SA_Password / inistial user configuration for this container?</p>

<p><a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes-manifest?view=azure-devops#deploy-action" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes-manifest?view=azure-devops#deploy-action</a></p>
<p>kubernetes-manifest deploy action doesn't have the option to add extra environment variables. Feel free to open a feature request at <a href="https://github.com/microsoft/azure-pipelines-tasks/issues" rel="nofollow noreferrer">https://github.com/microsoft/azure-pipelines-tasks/issues</a></p>
<ul>
<li><p>You can do two options, write a script with yq (<a href="https://github.com/mikefarah/yq" rel="nofollow noreferrer">https://github.com/mikefarah/yq</a>) to update the manifest files before deployment</p>
</li>
<li><p>Or use the KubernetesManifest patch option (<a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes-manifest?view=azure-devops#patch-action" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/kubernetes-manifest?view=azure-devops#patch-action</a>), for example</p>
</li>
</ul>
<pre class="lang-yaml prettyprint-override"><code>steps:
- task: KubernetesManifest@0
  displayName: Patch
  inputs: 
    action: patch
    kind: pod
    name: demo-5fbc4d6cd9-pgxn4
    mergeStrategy: strategic
    patch: '{&quot;spec&quot;:{&quot;template&quot;:{&quot;spec&quot;:{&quot;containers&quot;:[{&quot;env&quot;:[{&quot;name&quot;:&quot;SA_Password&quot;,&quot;value&quot;:&quot;1234&quot;}]}]}}}}'
    kubernetesServiceConnection: someK8sSC
    namespace: default
</code></pre>
