I have a IoT Edge Module that I want to deploy on my IoT Edge device.
In VSCode, I right-clicked on the deployment.template.jsonand then selected Build and Push IoT Edge Solution. The module has been built and pushed to my container registry. Then I right-clicked on the generated deployment.json and selected Create Deployment for Single Device and selected my IoT Edge device.
From VSCode, I have the following output:
[Edge] Start deployment to device [RaspberryPi]
[Edge] Deployment succeeded.
On the Azure Portal, I can see the module in the list of the device's modules. Its status is :
| SPECIFIED IN DEPLOYMENT | REPORTED BY DEVICE | RUNTIME STATUS |
|-------------------------|--------------------|----------------|
| Yes | No | -- |
But when I look at directly on my device, the deployment didn't start.
I checked the log with journalctl -u iotedge and I found nothing related to the deployment. Normally I should have something like starting pulling module xxx, Successfully pulled module xxx, Starting module xxx, Successfully started module xxx.
Does someone have an idea of how to solve this issue ? Thanks.
Related
I am attempting to configure the Log Analytics agent for Insights on my Azure VM running Windows. When I attempt to deploy the monitoring configuration, the DependencyAgentWindows VM extension fails to install. I have the same solution working on a similar VM and am stumped on what the issue is for the failing VM.
{"code":"DeploymentFailed","message":"At least one resource deployment> operation failed. Please list deployment operations for details.> Please see https://aka.ms/DeployOperations for usage
details.","details":"code":"VMExtensionHandlerNonTransientError","message":"The
handler for VM extension type
'Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows'
has reported terminal failure for VM extension
'DependencyAgentWindows' with error message: 'Install failed for
plugin (name:
Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows,
version 9.10.16.22650) with exception Command
C:\Packages\Plugins\Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows\9.10.16.22650\scripts\RunPs1.cmd
of Microsoft.Azure.Monitoring.DependencyAgent.DependencyAgentWindows
has exited with Exit code: 52'.\r\n \r\n'Install handler failed for
the extension. More information on troubleshooting is available at
https://aka.ms/VMExtensionDependencyAgentWindowsTroubleshoot'"}]}
I have tried to deploying the Monitoring Configuration and installing the DepencyAgentWindows VM Extension through the Portal and through PowerShell. I am expecting the DepencyAgentWindows VM Extension to install properly and be able to enable Insights successfully.
I tried to reproduce same in my environment I got the results successfully like below.
This issue usually occurs if network connectivity issues preventing the plugin from being downloaded and if the extension won't work properly if the vm agent is failing to report a status to the Azure platform..
To resolve this issue:
Try to delete if any other extension is already exists in your vm
In virtual machine -> extension -> uninstall
In monitor -> virtual machine -> configure insights -> enable -> monitoring configuration -> configure
When I try to deploy, it deployed successfully like below:
If still issue persists, try to uninstall the vm and Redeploy it and also check the MsDoc to know the supported operating system versions.
I have 1 function app that for some reason doesn't want to deploy (All 30 other function apps I manage deploy fine with the same ZipDeploy method).
After running the following AzureCLI command to deploy to an existing consumption based function app:
az functionapp deployment source config-zip --resource-group $resourceGroupName --name $functionAppName --src $artifactPath
This returns a successful deployment result (see bottom of question for the full JSON result), however looking in the Functions blade for the function app, this is empty:
My question is this - what am i doing wrong here? Why does deploying a function via AzureCLI fail?
A bit of background:
Functions we're using are precompiled C#
The function apps are created by Terraform
This function is a service bus trigger function that has the same host.json/functions.json as other successful function deployments
Things i've tried so far:
Deployed via the 'Publish' route in Visual Studio 2019 as a test. This works successfully.
Running the AzureCLI command locally, same result
Checked the function code structure against the suggested folder structure, this complies
Compared the zipped artifact i'm deploying against other successful deployment zips. Same structure as working functions.
Full logging from the AzureCLI command:
Setting SCM_DO_BUILD_DURING_DEPLOYMENT to false
Waiting SCM site to be updated with the latest app settings
Getting scm site credentials for zip deployment
Starting zip deployment. This operation can take a while to complete ...
Deployment endpoint responded with status code 202
Full JSON response from the AzureCLI command:
active : True
author : N/A
author_email : N/A
complete : True
deployer : ZipDeploy
end_time : 23/09/2020 16:32:28
id : 02c6219516244615beca1c126749baa1
is_readonly : True
is_temp : False
last_success_end_time : 23/09/2020 16:32:28
log_url : https://xxxx.scm.azurewebsites.net/api/deployments/latest/log
message : Created via a push deployment
progress :
provisioningState :
received_time : 23/09/2020 16:31:55
site_name : xxxx
start_time : 23/09/2020 16:31:55
status : 4
status_text :
url : https://xxxx.scm.azurewebsites.net/api/deployments/latest
EDIT 1: Here are the contents of the wwwroot folder for anyone interested - they follow the same structure as other functions we have (which deploy fine and display in the Functions view in the portal):
After long last we found out the cause of why the function app didn't deploy.
Turns out it deployed fine (the files were deployed in the right place) - it's just that the function runtime crashed on startup.
We found the usage of 'builder.Services.AddMvc()' caused this issue:
Which makes sense, given Azure Functions aren't Mvc. Derp!
We removed this line and voila, no more issues.
I might know what's wrong during your ZipDeploy process. Maybe the way you get your zip folder is wrong.
As I said, you can check if the destiny function app name is correct, and check if the content in https://<functionAppName>.scm.azurewebsites.net/DebugConsole -->site-->wwwroot(kudu) is correct.
The correct step of ZipDepoly is:
1. Click Publish option just like deployed via the 'Publish' route in Visual Studio 2019
2. Choose folder to create publish file.
3. Compress the publish file content you got from last step. The structure of publish file is same as in docs.
Publish.zip
| - bin
| - host.json
| - FunctionName
| | - function.json
4. Publish that zip file by your command. And the content of wwwroot should be same as publish file:
Background
I'm using Azure-cli (version >2.3.1) to create IoT Edge deployments:
echo az iot edge deployment create --content $(iotDeploymentPath) --deployment-id $(deploymentId) --hub-name ${hub} --priority $(priority) --target-condition "tags.location.place='$(env)'"
and for getting the metrics:
targetedCount="$(az iot edge deployment show-metric --deployment-id $(deploymentId) --metric-id targetedCount --hub-name ${hub})"
appliedCount="$(az iot edge deployment show-metric --deployment-id $(deploymentId) --metric-id appliedCount --hub-name ${hub})"
reportedSuccessfulCount="$(az iot edge deployment show-metric --deployment-id $(deploymentId) --metric-id reportedSuccessfulCount --hub-name ${hub})"
A few days ago, we got the following error message while trying to receive the deployment's metrics:
the metric 'targetedCount' is not defined in the device configuration
$(deploymentId)
the metric 'appliedCount' is not defined in the device configuration
$(deploymentId)
the metric 'reportedSuccessfulCount' is not defined in the device
configuration $(deploymentId)
with the following depracation message:
This extension 'azure-cli-iot-ext' is deprecated and scheduled for
removal. Please remove and add 'azure-iot' instead.
So I've installed 'azure-iot' instead of 'azure-cli-iot-ext', but now it seems like
az iot edge deployment show-metric stopped working and keeps sending the error message mentioned above.
the metric 'targetedCount' is not defined in the device configuration
$(deploymentId)
the metric 'appliedCount' is not defined in the device configuration
$(deploymentId)
the metric 'reportedSuccessfulCount' is not defined in the device
configuration $(deploymentId)
Question:
How can I get those metrics back without having the CLI deprecated extanstion version?
Quoting Azure support team answer:
I just received an update from our Product Group. They have informed
me that before azure-cli-iot-ext 0.8.7, iot edge deployment
show-metric would only work against system metrics. After, an argument
was introduced for the user to be able to switch between system and
user metrics but to match iot hub configuration show-metric, the user
metrics became the default (which carried over to azure-iot).
In addition, the PG member pointed out that all the metrics causing
issues with appear to be system metrics. In that case, please try
adding the --metric-type or –mt argument with value ‘system’.
For example:
az iot edge deployment show-metric -n myiothub -d mydeployment -m targetedCount --mt system
I have created a f# project that contains two functions. I can run theses locally and when I do func start (or start debug with F5 it in VS Code). One of the two functions copy data from one azure storage container to another and the other function copies some data from a DB and puts it in an azure storage container. All this works nicely when I run it locally. Now I would like to deploy these to Azure Functions. I have created a resource group, created the Function app and ensured that the Function App settings indicate that it is a Azure function version 2. When I try to deploy the functions via:
func azure functionapp publish <FUNCTION APP NAME>
The code is uploaded to Azure. And the output is:
Getting site publishing info...
Creating archive for current directory...
Uploading archive...
Upload completed successfully.
Syncing triggers...
In Azure portal under deployment options I see that a deployment has been triggered and looking at the details for the latest one I get:
Mon 09/17 Updating submodules.
Mon 09/17 Preparing deployment for commit id '75833a2816'.
Mon 09/17 Generating deployment script. View Log
Mon 09/17 Running deployment command... View Log
Mon 09/17 Running post deployment command(s)...
Mon 09/17 Syncing 2 function triggers with payload size 317 bytes successful.
Mon 09/17 Deployment successful.
This seems to indicate that two functions have been found and successfully deployed. However, the functions are not listed under the Functions under the Function App. And I have not been able to make successfull calls to them.
Do I have to provide some additional configuration in order to run a F# application as an Azure Function v2?
Here is what I see in the logs for Function App BokioMLDataExtractorFunctionsTest:
CopyImagesToBokioAIStorage: Invalid script file name configuration. The 'scriptFile' property is set to a file that does not exist.
CopyOcrToBokioAIStorage: Invalid script file name configuration. The 'scriptFile' property is set to a file that does not exist.
That is why the two functions are not showing up. Hopefully that helps figure out the issue?
I want to develop locally my Azure Function App and later publish it to Azure Portal.
I am using Azure Functions Core Tools command line and all my functions are in Node.js
Currently, I managed to download my functions locally and fetch their settings with command:
func azure functionapp fetch-app-settings
So after that my local.settings.json has correct settings values. When I make any changes I am also able to publish them succesfully to Azure Portal.
The problem is now that I have two functions in my app, one is Http Triggered and the second is EventHub triggered.
When I try run locally host with:
func host start
I get the following output from console:
[10.12.2017 13:03:47] Found the following functions:
[10.12.2017 13:03:47] Host.Functions.HttpTriggerJS1
[10.12.2017 13:03:47]
[10.12.2017 13:03:47] Job host started
[10.12.2017 13:03:47] The following 1 functions are in error:
[10.12.2017 13:03:47] EventHubTriggerJS1: The binding type 'eventHubTrigger' is not registered. Please ensure the type is correct and the binding extension is installed.
And when I try to run locally this EventHubTriggerJS1 function with curl:
curl --request POST -H "Content-Type:application/json" --data '{"input":"sample queue data"}' http://localhost:7071/admin/functions/EventHubTriggerJS1
then nothing happens, so I guess this is a problem of this trigger registration.
The HttpTriggerJS1 runs perfectly, I can access it under
http://localhost:7071/api/HttpTriggerJS1
So, do you have any idea where might be a problem in configuring? BTW Is it possible to have locally function and connect to the remote EventHub in portal?
I was unable to reproduce your error on the Version 1.0 runtime.
I reproduced the error in 2.0. I believe 2.0 does not support event hubs yet,
https://github.com/Azure/azure-webjobs-sdk-script/wiki/Azure-Functions-runtime-2.0-known-issues#functional-gaps
try installing the extensions
func extensions install --package Microsoft.Azure.WebJobs.Extensions.EventHubs -v 3.0.0-beta4
Can you provided more detail about your functions, and the steps you took to create them?
HttpTriggerJS1 was created locally and then published to the portal following the steps outlined in https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local ?
EventHubTriggerJS1 was created in the portal? in the same Function App?
Do not mix local development with portal development in the same function app. When you create and publish functions from a local project, you should not try to maintain or modify project code in the portal.