The documentation says that you can put a DLL in a bin folder and reference it using a special #r syntax, however in the Azure portal I cannot find how to upload these DLLs. Is this possible, and if so, how is that supposed to be accomplished?
This is possible.
You can use Kudu to upload your binaries:
Open the app's Kudu portal. If your Functions App's URL is samplefunctions.azurewebsites.net, then go to samplefunctions.scm.azurewebsites.net.
Click on the Debug console menu and select PowerShell. This will open up a PowerShell console plus a file explorer. Navigate to D:\home\site\wwwroot.
There you should see a folder which is named after your existing function. Navigate to that folder and drag-n-drop your binaries inside bin folder.
Now you can use them with #r directive.
I think you should also be able to configure the continuous deployment of your libraries to Functions (e.g. from a Git repo). Go to Function app settings -> Configure Continuous Integration.
Azure functions now has runtime support for precompiled functions.
https://blogs.msdn.microsoft.com/appserviceteam/2017/03/16/publishing-a-net-class-library-as-a-function-app/
You’ll need to use a web project which will provide the full development experience of IntelliSense, local debugging, and publishing to Azure. The instructions above detail how.
You're able to deploy your functions that has some external references just doing the deploy by Visual Studio Functions Tools.
Just configure your Azure account in your visual studio deployment settings, for your azure functions and play deploy. All references will be there in your Function App on azure.
You can use Octopus Deploy (Website deployment step) to deploy a function.
The folder structure of the nuget package pushed to octopus deploy should be:
nuget_package.nupkg
|--bin
|--*.dll
|--run.csx
|--function.json
You can add assembly reference with a relative path.
In portal.azure.com -> function apps, on the right hand side, View Files -> upload the dll (eg: YourDllName.dll).
In run.csx, enter #r "./YourDllName.dll"
Related
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 does Function App detects if a folder contains Functions?
As an incentive for the upcoming Azure Function Tools for VS, I followed the article here: https://blogs.msdn.microsoft.com/appserviceteam/2017/03/16/publishing-a-net-class-library-as-a-function-app/
I have successfully created Azure Function as a web-app project in Visual Studio, deployed the Function App using ARM template, then deployed the Functions using release step in Visual Studio Team Services.
Here are the contents of my Web App project, 'CustomerERPChange' is the Function that I want to get it showing in Azure.
Web App Project
What I'm expecting to see is the Function appearing in the Function App, but that doesn't seem to be the case..
Looking at Kudu I can confirm that the content of my project has been successfully deployed to the ../wwwroot directory, renaming the 'run.cs' back to 'run.csx' also didn't help.
Any idea and suggestion would be appreciated, thanks!
There are two ways to create function within Functions App,
1) using UI Create function with template of your choice,
2) from KuDu portal,
go to your_app_name.scm.azurewebsites.net,
create a folder in home > site > wwwroot > (function_name),
add run.csx or run.ps1, and function.json file to the newly created folder.
About these files :
run.csx or run.ps1 is a file which will automatically gets called when the function is executed.
function.json is a file which defines your function(either it is a timer or HttpTrigger, or other).
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.
I'm using the AzureContinuousDeployment.11.xaml Visual Studio 2013 Template for CI builds from visualstudio.com to an Azure website and it's working great.
However, I need to keep additional files on the server (the app creates files). If I was using the "Web deploy" method, I'd simply disable the "Remove additional files at destination" property, but I don't see an option for that using the Azure deployment template.
I should be able to add /p:SkipExtraFilesOnServer=True to the MSBuild arguments in the build definition, but it isn't working. Files are still being deleted from the web server when I deploy.
I've also tried creating a publish profile and adding it to the template. It hasn't worked either.
I don't think there is a way to keep app-created files while using visual studio deployment. I suggest you to create an Azure Storage account and store those files in the storage (blob would be good enough). It seams that you are using ASP.net. See more detail at Microsoft Azure Storage Client Library for .NET.
I have created a web role locally, but I am struggling to do this with the windows azure sdk, the manuals dont seem to give clear instructions on how?
Thanks
In Visual Studio, go in the Solution explorer panel, right-click on your Azure project and click on Package function. A process will generate the cspkg and cscfg files.
To create the .cspkg and .cscfg via MSBuild arguments:
/t:Publish /p:TargetProfile=Local /p:AutomatedBuild=True
or
/p:DeployOnBuild=true /p:TargetProfile=Local /p:AutomatedBuild=True
Remember to replace the TargetProfile with your actual desired profile. This will automatically pick up the right ServiceDefinition.profile.csdef file.
You have two options with Azure:
Build your package and upload it through the Azure portal https://manage.windowsazure.com/
In your Cloud project in Visual Studio right click and select "Package".
Select the service configuration and build configuration (Release, Debug) you want to package. Then hit on Package. This will build all the necessary projects for your cloud solution. Once finished, it will popup a window with 2 files: a cspkg and a cscfg. The cspkg can be opened with any zip software by the way.
Go to Azure portal. Select "Cloud Services". Select your cloud service name.
Click on "UPLOAD A NEW PRODUCTION DEPLOYMENT". Select your cspkg and cscfg files form step 2. Give a name to your deployment.
You're done.
Publish from Visual Studio.
To save the hustle right click on your Cloud project and select "Publish". Apply the necessary settings (Cloud service -this will populate automatically-, Environment, Release...as in the previous way. Make sure you go to Advanced settings to select the correct storage account if you got multiple. Hit Next, and the Publish. Visual Studio will do all the hard work for you.
Publishing from the GUIs (Azure Portal and Visual Studio right-click "Publish...") is fine to get started.
Eventually (sooner better than later) you'll want a reproducible scriptable one-button maker.
From within a Powershell script, the command Publish-AzureServiceProject is used to build the .cspkg and upload it. (I hesitate to say more; you'll get better results by scrutinizing their documentation, alas!)
In Visual Studio Team Services you can produce the package as follows:
The service configuration file is called "ServiceConfiguration.Cloud.cscfg" in this example. Ofcourse you can always use variables like $(BuildConfiguration). As platform I needed to use "anycpu" without a space, I was not able to get it working by using "any cpu".