CosmosDB SDK: System.IO.FileNotFoundException After Deploying to Azure - azure

I have an Azure Function App written in C# to which I added a reference to the CosmosDB SDK version 3.31. When I run the function app locally, it works fine, once I deploy it to Azure however I get a System.IO.FileNotFoundException indicating that Microsoft.Azure.Cosmos.Client cannot be found. I checked the dependencies set on the csproj file numerous times and everything seems to be correct.
I took a look at some Azure docs concerning troubleshooting which indicated that I should make sure that I'm using the most recent version of the SDK. I had been using version 3.29, so I upgraded to 3.31 and I'm still seeing the error in the function app log in Azure.
I am a little at a loss so any help anyone could provide would be terrific.

I have tried to reproduce the issue by creating a http triggered function (C#) in Visual Studio and added the CosmosDB SDK version 3.31 through the nuget package manager as shown in below screenshot:
Agreed with #Mark Brown and added the same cosmos DB SDK version and after adding the SDK I have tested in my local environment successfully:
Output screen in local environment:
Then published to the Azure App Service from the VS and tested the function in the Azure portal without any issues successfully as shown in the below output screen:
Note: Add the Cosmos DB SDK in the Nuget package manager and make sure to select (check box) your function app in VS as shown below:

Related

Azure Functions: The binding type(s) 'eventHubTrigger' are not registered

I have created an Azure Function to store messages from Azure IoT Hub to Table Storage using built endpoint of EventHub of IoT Hub. I am using Azure Functions v2(.Net Standard) for creating the EventHubTrigger functions.I developed the function and tested it locally and it is working as required. But when I am hosting this function in Azure, it shows the following error in the portal:
Error: The binding type(s) 'eventHubTrigger' are not registered. Please ensure the type is correct and the binding extension is installed.
I have already installed the Microsoft.Azure.WebJobs.Extensions.EventHubs -v 3.0.0-beta4 nuget package in the code.
Can someone help with this error as nothing much is mentioned regarding this in the docs.
Following are the packages installed in the solution:
Microsoft.NET.Sdk.Functions 1.0.13
Microsoft.Azure.WebJobs.EventHubs 3.0.0-beta4
NETStandard.Library v2.0.3
The different behavior is caused by old Azure Functions and Web Jobs Tools in VS, which means VS still consumes old function templates and cli.
Just update VS2017 to latest version(15.8.6 right now) and go to VS menus>Tools>Extensions and Updates, find Azure Functions and Web Jobs Tools, update it to latest version(15.10.2009.0 right now).
After steps of update, new EventHub trigger template works with Microsoft.NET.Sdk.Functions 1.0.22 and Microsoft.Azure.WebJobs.EventHubs 3.0.0. And the function cli is
Azure Functions Core Tools (2.0.3)
Function Runtime Version: 2.0.12115.0

azure cloud service node js "not a valid service package"

I have a cloud service in azure with two .NET worker roles and i want to add a Node JS webrole.
I have installed the Node.JS tools for visual studio which creates templates from which should allow node apps to be deployed as a web role.
Packaging of the service goes smoothly, but after publishing the cloud service via visual studio the following error message is shown:
The file provided is not a valid service package. Detailed error code: presentation Invalid application runtime - a runtime component is missing:/base/x64/WaIISHost.exe.
But when I look in the package file for the cloud service using an archiving tool and go to /base/x64/, the exe "WaIISHost.exe" is there.
I am quite stuck at the moment. There seem to be few other people that have this issue and I have already reinstalled the Azure SDK as suggested here and I am using the latest version (2.9.1).

VSO Continuous Deployment Fails w/ Multiple Sites in Web Role

I have configured a cloud service to run multiple web applications in one web role. More information on this is in the documentation.
The documentation does not appear to be correct for local builds with the Azure 2.3 SDK. Apparently, since SDK 1.8, the physicalDirectory attribute is not relative to the Azure cloud service project folder, but its output folder. Also see this question. By changing the path to ../../../Project.Name the service can be built and deployed locally from VS2013 with SDK 2.3.
We also use continuous integration on Visual Studio Online. However, the project now fails to build with the message that the path to my second web project is invalid. The path it's trying to use is C:\Project.Name\. I don't think this is quite correct.
I have tested with ../Project.Name as the physicalDirectory attribute value on VSO, but that also fails.
Is it a matter of somehow correctly configuring this for Visual Studio Online, or is it simply not currently supported?

Windows Azure SDK 2.0 missing in cloud service?

We just upgraded from the Windows Azure 1.7 SDK to 2.0.
This created a lot of problems in the codebase, but we got them ironed out and running locally.
Now when we try to publish to our cloud service machine in Azure, the worker role keeps trying to run but can't start.
My guess is that the cloud service machine is missing the 2.0 SDK.
Is there some way to install this manually on the remote machine? I can RDP and I've been looking around, but I can't seem to a) Verify which version it's trying to use and b) How to install a newer SDK.
I've found some errors about the worker role not running, but they're pretty uninformative.
The solution ended up being pretty simply, but I imagine other people will run into this problem.
We had 5-7 projects all referencing Azure SDK 1.8. Specifically these libraries:
Microsoft.ServiceBus
Microsoft.WindowsAzure.Configuration
Microsoft.WindowsAzure.Diagnostics
Microsoft.WindowsAzure.ServiceRunTime
Microsoft.WindowsAzure.StorageClient
If the project is a cloud service project, you need to right click on the project, go to properties, and upgrade the project. This changes the deployment when publishing. It will create the Azure VM based on the cloud service Azure SDK version. I missed that at first.
All the libraries above need to be upgraded to SDK 2.0 in all projects. Initially I missed some projects that were dependencies - and missing the Microsoft.ServiceBus library.
The last part was moving from Microsoft.WindowsAzure.StorageClient to Microsoft.WindowsAzure.Storage. I guess for SDK 2.0 they changed the library name, which has also introduced some breaking code changes.
After all that the cloud service now publishes correctly. Whew.

Azure build fail with TFS hosted buildserver: Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets" was not found

Im new to Azure and wanted to create a Continuous Integration build using TFS. I created a build definition but building my Cloud App with simple website using a hosted buildserver in the build definition fails with error:
C:\a\src\myAzure\myAzure\myAzure.ccproj (70): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.0\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I can however build locally, and manually Publish to Azure and it will deploy fine.
Im suspecting that the hosted buildserver of TFS does not support Azure 2.0?
Is there a way around this problem or will I have to forget the idea of using CI?
Seems to be so since the Build is a preview feature of the Team Foundation Service. There was the same thing with Azure SDK 1.8, but they updated the Build Servers in a couple of days. Hope that it will not take long this time.
UPDATE:
"No, TF Service hosted build machines do not have the new SDK 2.0 at this time. We expect all users to have Azure SDK 2.0 support post June 1st. In the meantime you will need to use an on-prem build controller with the bits you need and deploy to Azure from there."
(C) Trevor Hancock from Microsoft
http://social.msdn.microsoft.com/Forums/en-US/azuretfs/thread/2df796d5-1abb-4b89-a571-0b7a62b80d55
UPDATE 2:
I've managed to complete a successful build using TFS build servers with SDK 2.0 So I think this problem is resolved for now. In future I recommend not to do updates to new versions of Azure SDK until the TFS build servers are ready.

Resources