How to implement Nuget Package Restore In Azure Cloud Service - azure

After I follow this tutorial: http://docs.nuget.org/Consume/package-restore/team-build, I found 2 main issues or concerns:
When I am using Azure Cloud, my build process template will be Azure Continuous Deployment Template instead of using the Default Template, and this has a Solution to Build property instead of Projects so when you replace the .sln with build.proj, the build will generate an exception: "Exception Message: Please specify a Visual Studio Solution (.sln) to build. (type BuildFromSolutionException)"
Other issue that I maybe will face later is: how to specify my own nuget package sources? I may have additional sources beside https://www.nuget.org/api/v2/
Default Template
Azure Continuous Deployment Template

Related

Azure Functions with runtime 2; binding extensions not automatically created

When I deploy my Azure Function project to my Function App based on the v2 runtime, the binding extensions my project depend on (Azure Storage in my case), are not automatically created.
I deploy my project with an extensions.csproj file on the root, but after deploying I have to manually run the following command to create a bin and obj folder at wwwroot.
dotnet build extensions.csproj -o bin --no-incremental --packages D:\home\.nuget
If I understand correctly, this should happen automatically.
For deployment by CLI func azure functionapp publish
Function core tools use zip deployment to deploy functions, in this way, kudu doesn't build project by default. To enable the feature, set SCM_DO_BUILD_DURING_DEPLOYMENT to true in Application settings on portal.
As for why the default setting is false, zip deployment usually requires the content to be deployed including all related files hence there's no need to build again.
For Azure function core tools, we usually use command func extensions install to register extensions for input/output binding when extensions are not installed automatically like we create trigger from template. This is why command func start and func azure functionapp publish doesn't build extensions.csproj, extensions are supposed to be installed before we run or publish functions.
Update for DevOps deployment
With Azure pipeline, we need to build extensions.csporj before archive files. Add a .NET Core build task, arguments are -o bin.
If you want kudu to build project, go to Deployment Center under Platform features. Choose VSTS as a CI repository and kudu will build and deploy project for you.
When using Visual Studio, you'll be referencing the extension packages directly from your project in order to use their attributes and other types, so Visual Studio handles the installation process, but registration still needs to be performed.
This is handled by a custom build task, added by the Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator NuGet package, which must be explicitly referenced (this will be automatically brought in by the SDK/Visual Studio tools in a future update).
These are the steps you must follow to use the CosmosDB extension mentioned in our previous example:
1.Add a reference to the Microsoft.Azure.WebJobs.Extensions.Storage NuGet package
2.Add a reference to the Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator
3.Build the project
For more details, you could refer to this article.

How can I deploy a html website using Azure Resource Manager

I've got a website (basic html) and I want to deploy it using Azure Resource manager. It doesn't have a visual studio sln file and I don't want to create one.
I've found this tutorial for an angular website that does something along the lines that I am trying to do. http://www.azurefromthetrenches.com/how-to-publish-an-angularjs-website-with-azure-resource-manager-templates/
The problem I want to solve is that I have the Microsoft Azure SDK for .NET (VS 2015) 2.8.2 which allows me to add resources to my resource group project. The tutorial writes everything itself, rather than use visual studio to create the resources.
Does any one know how to do this?
I've got my application to build the website using a website.publishproj (found at the tutorial) so I have my zip file, what I am now lacking, is how to upload the zip file to azure using the already existing powershell that comes with the 2.8.2 SDK.
So far i've added the below code under the Import-Module statement:
C:\"Program Files (x86)"\MSBuild\14.0\bin\msbuild.exe 'C:\Source\website.publishproj' /T:Package /P:PackageLocation=".\dist" /P:_PackageTempDir="packagetmp"
$websitePackage = "C:\Source\dist\website.zip"
If you're ultimate goal here is the ability to simply deploy and changes to the Azure Web App, one solution is to setup automated deployment from a local Git repository into an Azure Web App. Firstly, you'd create the RG in the Azure portal then configure Continuous Deployment. You can then use something like Visual Studio Code to trigger the deployment from any code changes.
Good run through here: https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-app-using-vscode/
Assuming your website is under source control eg. GitHub - you can use an ARM template to point at the GitHub repo, so when it creates a new website it will automatically pull the content into your newly created site. Great walkthrough here: https://azure.microsoft.com/en-us/documentation/articles/app-service-web-arm-from-github-provision/ or just the code can be found here: https://github.com/Azure/azure-quickstart-templates/tree/master/201-web-app-github-deploy.
You can use Azure CLI from non-Microsoft world to deploy eg.
azure group deployment create...
If this has helped, please mark as answered.

TFS Team Build: Deploy Azure Cloud Service

I'm having some trouble deploying an Azure Web Service using the new Team Build that is available at Visual Studio Online. When the solution have been built successfully, the deployment task tries to find the CsPkg and the CsCfg, which fails.
How do I specify the "Path of CsPkg/CsCfg under the default artifact directory" that is required? Do I have to specify some MSBuild arguments?
You can use the $(build.stagingDirectory) variable in the CsPkg/CsCfg fields. This will be the root of your repo. Your binaries will be at some location under there. E.g. $(build.stagingDirectory)\*.cspkg and
$(build.stagingDirectory)\*.cscfg
There's a huge list of built-in variables on MSDN.
You may also have to build your cloud service project with the MSBuild argument /t:Publish
I just checked: If you use the "Cloud Service" deployment template, all of this stuff is automatically filled in for you, including the paths.

Azure Continuous Deployment - Setup Publishing with VSO

We've been able to setup Azure Continuous Deployment with some VSO Team Projects, but not others. Any idea why we are getting this error in the Azure Management Portal? Perhaps it depends on the age of the team project.
Unable to find AzureContinuousDeployment.11.xaml in TeamProject see [Link]
We've followed the directions suggested:
Integrating Azure Continuous Integration with VSO
Add Build Template AzureContinuousDeployment.11.xaml to $/[TeamProject]/BuildProcessTemplate
Created Build Definition in [TeamProject] referencing AzureContinuousDeployment.11.xaml in Step 1 (i.e. Registering the Template)
Proceed with "Set up publishing with Visual Studio Online". Enter VSO host and select [TeamProject].
I can see there are connected services under the [Team Project] in VSO (under Team Project Admin -> Services).
Turns out the Azure Portal/VSO error message needs updated to reflect new Azure Continuous Deployment updates for TFS 2013 (Microsoft.TeamFoundation.Build.Client).
Proper Error Message
Unable to find TfvcContinuousDeploymentTemplate.12.xaml in [TeamProject] see [Link]
The fix is to upload the TFS 2013 Azure CD template and create a build definition to register the template with the [TeamProject].
This is only necessary for older VSO projects that don't get the default Azure CD build template.

Publish Azure Application with MSBuild

Visual Studio 2013 has a publish wizard for Cloud Service projects that packages and deploys a cloud service based on settings persisted in a .azurePubxml file.
I'm setting up automation of this process on a CI server, and want to leverage this functionality within MSBuild, but I'm unsure if it's even possible.
I have found a lot of articles that talk about shelling out to a PowerShell script and using a custom MSBuild target file to do the deploy, but that seems like a duplication of information that I'd rather not delve into.
Given that I have the Azure subscription credentials installed on the build machine, VS 2013, and Azure SDK 2.2, can I invoke the same mechanism that VS 2013 uses in the publish wizard to package and deploy my cloud service?
Currently, using MSBuild with the publish target, I can package the service into a .cspkg file, but I cannot figure out how to trigger to package/deploy based on a profile (.azurePubxml file) that defines the VS build config, and all of the Azure settings.
So, as you pointed out, the default targets will only give you a package. From there, Visual Studio is publishing things using their own infrastructure. Publishing the build from a CI server is considered something external to actual build process and rather something that is part of the deployment process.
If your CI technology has support for PowerShell then it's as easy as automating the Windows Azure PowerShell cmdlets to do your bidding. There's a nicely detailed article on how you might do this with Team Builds in TFS here on MSDN.

Resources