I wonder - is there a way to pick up the code from a specific branch only? If I am right, if I follow the following tutorial Deploying-from-GitHub push to any branch gets picked up?
So if you would use Azure Portal to configure this, you can select a branch to deploy from. If you are using ARM templates, you can also specify branch:
"properties": {
"RepoUrl": "[parameters('repoURL')]",
"branch": "[parameters('branch')]",
"IsManualIntegration": true
}
to get it working for local git deployment option, here is the answer: https://github.com/projectkudu/kudu/wiki/Deployment-branch
you can set the branch by setting an Azure App Setting called
deployment_branch.
Related
I'm using the github rest api to create repo environments:
https://docs.github.com/en/rest/reference/repos#create-or-update-an-environment
The api allows us to select deployment_branch_policy.custom_branch_policies: (boolean) but I can't find a way of creating a deployment branch rule with a custom pattern, like you would do on the UI:
Is there any way of creating this through the REST api?
Many thanks
It should be possible to do via the Deployment branch policies API:
The Deployment branch policies API allows you to specify custom name patterns that branches must match in order to deploy to an environment. The deployment_branch_policy.custom_branch_policies property for the environment must be set to true to use these endpoints. To update the deployment_branch_policy for an environment, see "Create or update an environment."
For more information about restricting environment deployments to certain branches, see "Using environments for deployment."
I have an Azure Data Factory with a linked Azure Databricks service like this:
The Databrick Workspace URL is not the same in all my environments so I need to parameterize it and include the parameter in the ARM template. I added a global parameter to the Data Factory and ticked "Include in ARM template" but when that was deployed, it removed the ADF's binding to the Git repo.
I have also tried it using the ARM Parameter Configuration:
I added this section under Microsoft.DataFactory/factories/linkedServices to the ARM template instead of using a global parameter:
"AzureDatabricks": {
"properties": {
"typeProperties": {
"domain": "="
}
}
},
Again it removed the ADF's Git binding when it was deployed. Does anyone know a way to parameterize a field without removing the Git binding?
After changing the ARM template as described in the question, I deployed and it did remove my Git binding. I added the binding back in and deployed again. Now I have both the Git binding and the parameter I needed.
I'm trying to create a webapp in azure using VSTS as the source controls. I have this:
"properties": {
"repoUrl": "https://clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]",
"branch": "master",
"isManualIntegration": true
}
But I get a failed provisioning state when I try this. What URL do I have to use in the template if I want to use VSTS?
I dont think VSTS allows public repos, so you would have to authenticate to the VSTS before doing this template deployment (if this is even possible).
But since you have VSTS you are probably better off configuring a proper build\release pipeline using VSTS.
I've managed to solve my own problem. Instead of using the git url provided by the repo, use: https://[username]:[Personal Access Token]#[url] to authenticate with VSTS
so in my example, I might use
https://collin:123456780abcdefg#clt-8601add0-7378-4c18-839d-8c46ac1cdd98.visualstudio.com/ResourceManagerTest/_git/[ProjectName]
We are using VS 2017 on a single solution with multiple projects and we right mouse click and deploy 3 C# Azure Function to two different Azure Function apps with slots.
How do you set up the VSTS build definition to accomplish this on every check in?
We are using the DLLs and setting up the function.json this way. I don’t know if we need to deploy differently based on this type of configuration.
"scriptFile": "..\\bin\\target.dll",
"entryPoint": "target.Application.Run"
I was able to create a VSTS deployment through the following steps
Solutions structure
Build Configuration Steps
Sync from master branch
Added Nuget Restore using default options
Added MSBuild Step with the followign optons
Project : vstsSolution.sln (Selected using '...')
MSBuild Version: Latest
MSBuild Architechture: MSBuild x86
Clean: Checked
Create Log File: Checked
Added App Service Deploy for Function App1
Azure Subscription: Target Subscription
App Service Name: Target Function App
Deploy to slot: If you check this it allows you to select the actual slot you want to deploy to
Package or folder: FunctionApp1\bin\Debug\net461
Added App Service Deploy for Function App1
Package or folder: FunctionApp2\bin\Debug\net461
Make sure you selected "Hosted VS2017" Agent Queue for this build.
All Build Steps
Triggers: Enable Continuous Integration. So that both function app deploy every time you check-in.
Continuous Integration
I see several examples of Azure Resource Manager templates, referencing artifacts directly in Git Hub.
As in the following example, taken from this quick start template:
"modulesUrl": {
"type": "string",
"defaultValue": "https://github.com/Azure/azure-quickstart-templates/raw/master/dsc-extension-azure-automation-pullserver/UpdateLCMforAAPull.zip",
"metadata": {
"description": "URL for the DSC configuration package. NOTE: Can be a Github url(raw) to the zip file (this is the default value)"
}
As an orgnaisation, we can't use free Git Hub as code is public and as we pay for VSTS already... At the moment, we have to upload artifacts to Azure Storage Accounts using the VSTS build task Azure Resource Group Deployment task and reference them from there. It would be nice if we could remove this step.
So, is there a way to reference artifacts directly from a VSTS repository in a similar way to Git Hub? I assume the URI would require some form of authentication, such as a PAT token.
All I can find is this, but I think it is referring to packages. I don't need to create packages for ARM templates and DSC configurations.
There is a task called Azure Resource Group Deployment Task, we use this to deploy the ARM template.
According to you sample template, it's using publicly accessible http/https URLs in GitHub. Afraid this is not accessible via vsts url. In VSTS you need to follow below process (Need to use a SAS Token):
You could provide some extra parameters using the output variables defined in the Azure File Copy Task (storageURI, storageToken). This are needed because in the template we use the _artifactsLocation and _artifactsLocationSasToken parameters to build the storage URL to the files.
More details please refer this blog: Setting up VSTS with ARM Templates