Setup Web app deployment settings with a script

MoTaar 310 Reputation points
2024-02-14T22:38:10.04+00:00

Hello, can you help out on the script that set up the deployment setting for a web app. In my case I trying to connect it to an Azure devops Branch. Thank you! Screenshot that shows how to choose the deployment source.

Microsoft Deployment Toolkit
Microsoft Deployment Toolkit
A collection of Microsoft tools and documentation for automating desktop and server deployment. Previously known as Microsoft Solution Accelerator for Business Desktop Deployment (BDD).
892 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,509 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
926 questions
0 comments No comments
{count} votes

Accepted answer
  1. VenkateshDodda-MSFT 20,696 Reputation points Microsoft Employee
    2024-02-15T11:10:00.4533333+00:00

    @MoTaar Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    Based on the shared information, I understand that you are looking for a script to update the source control settings of your app service with AzureRepos.

    You achieve this by using the Azure CLI cmdlet az webapp deployment source config

    az webapp deployment source config --branch {branchName} --repo-url {repo-Url} -g {ResourceGroupName} -n {WebAppName} --manual-integration $false
    

    Alternatively, you can add the source controls using the Azure Management Create or Update Source Controls Rest API with below Request body.

    https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/sourcecontrols/web?api-version=2022-03-01
    
    {
      "properties": {
        "repoUrl": "<Repo_Url>",
        "branch": "<BranchName>",
        "isManualIntegration": false,
        "isGitHubAction": false,
        "isMercurial": false
      }
    }
    

    Request body:

    {
    "properties": {
    "repoUrl": "<Repo_Url>",
    "branch": "<BranchName>",
    "isManualIntegration": false,
    "isGitHubAction": false,
    "isMercurial": false
    }
    }
    

    Hope this helps, let me know if you have any further questions on this.

    Please accept as Yes if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.


1 additional answer

Sort by: Most helpful
  1. Silvia Wibowo 3,906 Reputation points Microsoft Employee
    2024-02-15T03:49:12.8233333+00:00

    Hi @MoTaar , as you want to use Azure DevOps, you need to select Azure Repos, which refers to Azure Repository inside Azure DevOps.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.