Deploying to Azure using VSTS repository in ARM Template - azure

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]

Related

Azure Data Factory - Add parameter to ADF linked to Git repo

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.

Create Azure Devops environment from script

I would like to create an Azure DevOps Pipeline Environment from Powershell.
Using Azure CLI or the Azure REST API however, I can not find any information on this.
There are some notions about the environments in the release but that's not what I need.
When using the portal following URL is called "/_apis/distributedtask/environments" but can't find any information about this REST API endpoint.
Does anyone know how to automate this?
You're right, If I check the network section when I create a new environment I can see it uses this api:
https://dev.azure.com/{org}/{project}/_apis/distributedtask/environments
With this JSON body:
{
"description":"",
"name":"test"
}
I don't see it domunetd but it should work :)

Azure Data Factory V2 Copy activity Mapping deployment issue

Consider following test Mapping for Data Factory Copy activity:
"translator": {
"columnMappings": "#json('{\"from\":\"to\"}')",
"type": "TabularTranslator"
}
After deploying pipeline with the help of Set-AzureRmDataFactoryV2Pipeline PowerShell cmdlet we get normally deployed pipeline with the exact columnMappings value as specified in source code. But if you try to be more dynamic:
"translator": {
"columnMappings": "#json(pipeline().parameters.Mapping)",
"type": "TabularTranslator"
}
then after deployment you'll find that translator element is completely missing in pipeline. A workaround - set translator in Azure Portal Data Factory pipeline editing UI (either in Designer or JSON modes - both options work). But if after these manipulations you save pipeline JSON to the file and attempt to deploy it via Set-AzureRmDataFactoryV2Pipeline PowerShell cmdlet - bang, translator becomes missing. Expected result - deployment shall preserve translator element, because Portal JSON Editor preserves it.
We are doing automated deployment of pipelines (as you already figured out - with the help of Set-AzureRmDataFactoryV2Pipeline) and this bug breaks our automated deployment because it requires manual postdeployment pipeline editing on Azure Portal UI.
What may be the reason of such a buggy behavior? Can you suggest an idea how to work around this bug in automated way, or how to fix the code so it can be properly deployed with Set-AzureRmDataFactoryV2Pipeline?
You could try whether "Update-Module -Name AzureRm.DataFactoryV2" helps. It might be caused by that your powershell module is out of date.

Visual Studio Team Services: Raw link to build artifacts

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

Azure App Service - deployment from a specific branch in GitHub

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.

Resources