VMExtensionProvisioningError while deploying a virtual machine - c#

I am trying to deploy a virtual machine in azure via JSON using as much as possible JSON templates and parameters, when i try to generate an extension for the VM i get the error:
"VMExtensionProvisioningError"
with the message:
"Failed to decode, decrypt, and deserialize the protected settings string. Error Message: Keyset does not exist"
And i dont know what this stands for.
{
"apiVersion": "2017-12-01",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(parameters('virtualMachineName'),'/CustomScriptExtension')]",
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.7",
"autoUpgradeMinorVersion" : true,
"settings": {
"fileUris": [
"https://{storageAccountName}.blob.core.windows.net/scripts/{scriptName}"
],
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -file "{scriptName}" ')]"
},
"protectedSettings": { "storageAccountName": "[parameters('storageAccountName')]" }
},
"type": "Microsoft.Compute/virtualMachines/extensions"
},
What i am trying is to execute a script obtained from a blob in Azure.
What i am doing wrong?

Related

What do I need to do to make a Teams bot callable

I'm trying to create a Microsoft Teams bot that can be called. Especially, we plan to use it as a destination for incoming calls on a Call Queue.
It seems that the call buttons
we usually get with contacts are nowhere to be seen on this bot:
So far, I have managed to create a bot according to the samples.
In https://dev.botframework.com/, the bot appears and I have the Enable Calling flag set (which - interestingly, seems to get disabled almost every time I run the project in Visual Studio).
My permissions.json looks like this:
[
{
"resource": "Microsoft Graph",
"delegated": [
"User.Read"
],
"application": [
"Calls.Initiate.All",
"Calls.InitiateGroupCall.All",
"Calls.JoinGroupCall.All",
"Calls.AccessMedia.All"
]
}
]
My manifest.template.json looks like this:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.13/MicrosoftTeams.schema.json",
"manifestVersion": "1.13",
"version": "1.0.0",
"id": "{{state.fx-resource-appstudio.teamsAppId}}",
"packageName": "com.microsoft.teams.extension",
"developer": {
"name": "Teams App, Inc.",
"websiteUrl": "{{state.fx-resource-frontend-hosting.endpoint}}",
"privacyUrl": "{{state.fx-resource-frontend-hosting.endpoint}}{{state.fx-resource-frontend-hosting.indexPath}}/privacy",
"termsOfUseUrl": "{{state.fx-resource-frontend-hosting.endpoint}}{{state.fx-resource-frontend-hosting.indexPath}}/termsofuse"
},
"icons": {
"color": "resources/color.png",
"outline": "resources/outline.png"
},
"name": {
"short": "{{config.manifest.appName.short}}",
"full": "{{config.manifest.appName.full}}"
},
"description": {
"short": "Short description of {{config.manifest.appName.short}}",
"full": "Full description of {{config.manifest.appName.short}}"
},
"accentColor": "#FFFFFF",
"bots": [
{
"botId": "{{state.fx-resource-bot.botId}}",
"scopes": [
"personal",
"team",
"groupchat"
],
"supportsFiles": false,
"supportsCalling": true,
"supportsVideo": true,
"isNotificationOnly": false
}
],
"composeExtensions": [],
"configurableTabs": [],
"staticTabs": [],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [],
"webApplicationInfo": {
"id": "{{state.fx-resource-aad-app-for-teams.clientId}}",
"resource": "{{state.fx-resource-aad-app-for-teams.applicationIdUris}}"
}
}
I also believe to have configured the correct permissions on the App Registration in Azure:
Any idea where to look next? What do I need to do to make the bot directly callable as I would be able to with any other user?

React/ASP - Support for the experimental syntax 'classProperties' isn't currently enabled

Have been following a post which details the steps required for setting up React with C#. However, I am being presented with the following error everytime I try to compile a React application:
Support for the experimental syntax 'classProperties' isn't currently enabled
onChange = (e) => {
this.setState({ value: parseInt(e.currentTarget.value, 10) });
};
The error message outlines:
Add #babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation. If you want to leave it as-is, add #babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.
Therefore, I altered my package.json to suit:
{
"name": "Test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --config=Scripts/React/config/webpack.config.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#babel/core": "^7.10.3",
"#babel/plugin-proposal-class-properties": "^7.10.1",
"#babel/preset-react": "^7.10.1",
"#babel/preset-env": "^7.2.3",
"babel-preset-react": "^6.23.0",
"babel-loader": "^8.1.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"react-countup": "^4.3.3",
"react-router": "^5.2.0",
"react-svg-gauge": "^1.0.10",
"reactstrap": "^8.5.1",
"recharts": "^1.8.5"
},
"babel": {
"presets": [
"#babel/preset-env",
"#babel/preset-react"
],
"plugins": [
"#babel/plugin-proposal-class-properties"
]
}
}
Despite this, I am still receiving the same error. Does anyone have any ideas as to how I can mitigate this issue?
Try this , possible duplicate Support for the experimental syntax 'classProperties' isn't currently enabled
"plugins": [
[
"#babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]

FunctionInvocationException when Azure function is called

I'm having an issue with my Azure function. The function cannot startup because a FunctionInvocationException is being thrown each time.
The inner exception being an InvalidOperationException with the below message:
PartitionKey must be supplied for this operation
I have two bindings in my function that connect to a Document DB, one is an in binding that retrieves a specific document from a collection, and the other is an out binding used for auditing.
These both work fine in my dev, qa, and uat environments it is only the production environment that is having an issue. Both collections (for the settings and the auditing) were created without a partition key, the same as every environment.
System.InvalidOperationException:
at Microsoft.Azure.Documents.Client.DocumentClient+d__347.MoveNext (Microsoft.Azure.Documents.Client, Version=1.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
Any ideas?
I've tried deleting and remaking the audit collection but that didn't work. I don't get why the other environments are fine, but this one isn't.
Edit:
The function.json
{
"scriptFile": "..\\bin\\Cso.Notification.Function.dll",
"entryPoint": "Cso.Notification.Function.Program.Run",
"disabled": false,
"bindings": [
{
"type": "httpTrigger",
"direction": "in",
"webHookType": "genericJson",
"name": "request",
"methods": [
"post"
]
},
{
"type": "documentDB",
"name": "subscriberSettings",
"databaseName": "CSO",
"collectionName": "Settings",
"id": "SubscriberSettings",
"connection": "CsoDocDb",
"direction": "in"
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"type": "documentDB",
"name": "collector",
"databaseName": "CSO",
"collectionName": "AuditJSON",
"connection": "CsoDocDb",
"direction": "out"
}
]
}
I've found an answer. One of the documents we were querying for an initial value (SubscriberSettings) was incorrectly setup with a PartitionKey.
Deleting the collection and remaking it without a partition key did the trick.

Bot framework - Getting the user's answers from a form generated by json schema

I am using the function to BuildJsonForm to define a form using a JSON schema. I generate the JObject with some parameters the bot asks the user during runtime.
An example of the JObject/JSON I send to the function BuildJsonForm is this one:
`
{
"References": [
"Microsoft.Bot.Connector.dll",
"System.dll",
"mscorlib.dll",
"System.Net.Http.dll"
],
"Imports": [
"Microsoft.Bot.Connector.ThumbnailCard",
"Microsoft.Bot.Connector.StateClient",
"System.Net.Mail",
"System",
"System.Text.RegularExpressions",
"System.Net.Http",
"System.Net",
"System.Text"
],
"type": "object",
"required": [
"username",
"password"
],
"Templates": {
"NotUnderstood": {
"Patterns": [
"I do not understand, Please rephrase that"
]
},
"EnumSelectOne": {
"Patterns": [
"Choose one please"
],
"ChoiceStyle": "Auto"
}
},
"properties": {
"username": {
"Prompt": {
"Patterns": [
"Tell me the {&}, please",
"I need you to especify a {&}, please"
]
},
"type": [
"string",
"null"
],
"Templates": {
"NotUnderstood": {
"Patterns": [
"That is not a valid input"
]
}
}
},
"password": {
"Prompt": {
"Patterns": [
"Tell me the {&}, please",
"I need you to especify a {&}, please"
]
},
"type": [
"string",
"null"
],
"Templates": {
"NotUnderstood": {
"Patterns": [
"That is not a valid input"
]
}
}
}
},
"OnCompletion": "await context.PostAsync(\"Thank you!\"); string files = \"\"; context.PrivateConversationData.TryGetValue<string>(\"Files\", out files); [more code...]"
}
`
I need to send to the database the user's answers to the generated JObject/JSON form's questions, but so far, I haven't found a way to do that.
I also tried accessing the BotData with this line context.PrivateConversationData.TryGetValue<string>("Files", out files);, so I could send the user's answers to the database directly from the "OnCompletion" section of the JSON, but still I can't seem to access to the botdata or context on the OnCompletion section.
Is there any other way I can successfully retrieve the user's responses to the JObject/JSON generated form after the user answers the last question in the form?
It seemed that what was causing the trouble in my project were sending this parameters to the function:
GeneratedForm.BuildJsonForm(channel, user, convers);
since I edited the function without those parameters and I stopped getting the exception specified in the question. I will look for the reason these parameters were causing problems but the solution I found in this case was to define the funtction this way:
GeneratedForm.BuildJsonForm();

Connecting Azure Function to Azure Storage Blob with HTTP trigger

I came across multiple ways of connecting Azure Storage Blobs to Azure (like this one for example) Functions but all of them require me to use a BlockBlob type parameter in my Run function, therefore replacing the HTTPRequestMessage parameter I need. Is there a way to keep the HTTPRequestMessage parameter and connect to Azure Storage Blob?
Ultimately, I need to get a file reference from the blob to send to another service via Azure Function.
When I try to add more parameters to Run, the function compiles properly, but I am returned a 500 error. When I change the parameters back to two, it works properly. The only difference is the parameter and function.json to which I add a section resulting in the entire file looking like this :
{
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"methods": [
"get",
"post"
]
},
{
"type": "blob",
"name": "myBlobbo",
"path": "mycontainer",
"connection": "value",
"direction": "inout"
},
{
"name": "$return",
"type": "http",
"direction": "out"
}
],
"disabled": false
}
// Alright, now the logs are telling me that I didn't specify a connection string, even though I have a local.settings.json file with this inside:
{
"ConnectionStrings":
{
"xyz": "DefaultEndpointsProtocol=https;AccountName=xxx;AccountKey=yyy;EndpointSuffix=core.windows.net"
}
}
I'm probably going to just connect manually via passing an URI to CloudBlobContainer and using a file stream or %TEMP% to pass the contents, but I still would very much like to know how to get this binding to work.
// I'm using Azure environment to develop the function.
Following example shows how to get blob content with HttpRequest (HttpTrigger, Blob input, Http out):
run.csx
using System.Net;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, string inputBlob, TraceWriter log)
{
log.Info("Blob content: " + inputBlob);
return req.CreateResponse(HttpStatusCode.OK, inputBlob);
}
functions.json
{
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"methods": [
"get",
"post"
]
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"type": "blob",
"name": "inputBlob",
"path": "incontainer/myblob.txt",
"connection": "AzureWebJobsDashboard",
"direction": "in"
}
],
"disabled": false
}
storage:
AzureWebJobsDashboard:

Categories

Resources