Using ARM template to deploy WebJob - azure-webjobs

I am currently attempting to deploy a webjob as part of my app service through an ARM template. Does anyone have a sample of doing this through a zip deploy?
I have seen here and the linked question there about creating an arm template for a scheduled job but it was not completely clear on how to do it for continuous webjobs/how one would utilize zip deploy to deploy their files.
I currently have a section like this
{
"comments": "Defines an Azure Web App.",
"type": "Microsoft.Web/sites",
"name": "[parameters('siteName')]",
"apiVersion": "2015-08-01",
"location": "[variables('siteLocation')]",
"kind": "appservice",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]",
"ConfigJson",
"MdsConfigXml",
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('appServicePlanName'))]": "empty"
},
"properties": {
"sourcePlatform": "Unknown",
"targetPlatform": "Unknown",
"serverFarmId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('appServicePlanResourceGroup'), '/providers/Microsoft.Web/serverfarms/', parameters('appServicePlanName'))]",
"siteConfig": {
"phpVersion": "off",
"scmType": null,
"netFrameworkVersion": "v4.0",
"use32BitWorkerProcess": false,
"webSocketsEnabled": false,
"alwaysOn": "[parameters('alwaysOn')]",
"httpLoggingEnabled": true,
"logsDirectorySizeLimit": 50,
"appSettings": [
{
"name": "APPINSIGHTS_PROFILERFEATURE_VERSION",
"value": "1.0.0",
"slotSetting": true
}
]
}
},
"resources": [
{
"apiVersion": "2018-02-01",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"name": "ZipDeploy",
"properties": {
"packageUri": "[parameters('deployPackageUrl')]"
},
"type": "extensions"
}
]
}
With the deployPackageURL linked to my zip file, which contains my webjob project. However when checking the app service resource, no webjob has been deployed. Can anyone point out possible errors in my ARM template? Thanks!

We can not deploy webjobs using ARM template.
If you just want to deploy Web App with a Scheduler Job, here is a sample for Scheduler Job Collection.
Here is the ways you could create WebJobs inside Web App.
Using the Azure portal.
Copying files directly in their proper location.
Deploying .NET Console WebJobs alongside an ASP.NET application
Deploying a WebJob using PowerShell ARM Cmdlets

Related

Custom Teams Office 365 Connector cannot be setup

The problem
I am trying to build a configurable team tab with a custom connector but having serious issues when the teams app is installed and try to configure the connector. I created tab apps and they work fine. But the connector, on its own or with a tab fails to config.
The connector custom configuration page is opened in a new window and shows the config page but the Teams SDK does not initialize. The microsoftTeams.initialize() function doesn't seem to do anything. Callbacks for functions like microsoftTeams.settings.setSettings(settings) and microsoftTeams.settings.getSettings() are never called.
I have tried dozens of samples and both node.js and csharp projects. I have tried building connectors in the teams app builder, yo teams, and VSCode Teams Toolkit. I even tried different versions of the teams SDK. Made no difference.
I read all the SO questions and Teams SDK github issues and none of those suggestions or solutions made a difference.
Does anyone know if custom created Office 365 Connectors still work in Teams or what I am doing wrong?
Could it be my sandbox teams/office environment?
Here is my configuration:
Created a sandbox Office/Teams dev environment with fake users + Azure per
the docs. I have not tried production Teams/Office yet.
Changed the Teams admin setting to allow sideloading
Created connector registration (created multiple times, not edited)
on outlook.office.com.
Created the connector config page (in a few
different ways) Hosted on ngrok (and azure - made no difference)
Uploaded app in "Manage Your Apps" -> "Upload Custom App"
Select a Team channel to install the app
Configured connector in the Team Channel
Clicked "Visit Site To Install" link
Config page opens but none of the Teams SDK works - I added console.log everywhere to verify
Manifest:
This is the default Quick scaffolded yo teams configurable tab and connector
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json",
"manifestVersion": "1.9",
"id": "c8012880-98bc-11ec-bee3-ab9042a78ecb",
"version": "1.0.1",
"packageName": "tabappl",
"developer": {
"name": "mytest",
"websiteUrl": "https://48fb-80-233-63-141.ngrok.io",
"privacyUrl": "https://48fb-80-233-63-141.ngrok.io/privacy.html",
"termsOfUseUrl": "https://48fb-80-233-63-141.ngrok.io/tou.html"
},
"name": {
"short": "tabappl",
"full": "tabappl"
},
"description": {
"short": "TODO: add short description here",
"full": "TODO: add full description here"
},
"icons": {
"outline": "icon-outline.png",
"color": "icon-color.png"
},
"accentColor": "#D85028",
"configurableTabs": [
{
"configurationUrl": "https://48fb-80-233-63-141.ngrok.io/tab1Tab/config.html?name={loginHint}&tenant={tid}&group={groupId}&theme={theme}",
"canUpdateConfiguration": true,
"scopes": [
"team"
]
}
],
"staticTabs": [],
"bots": [],
"connectors": [
{
"connectorId": "76a7925f-e99f-4d9e-970b-b1bee2390f2c",
"configurationUrl": "https://48fb-80-233-63-141.ngrok.io/tabapplConnector/config.html?name={loginHint}&tenant={tid}&group={groupId}&theme={theme}",
"scopes": [
"team"
]
}
],
"composeExtensions": [],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"https://48fb-80-233-63-141.ngrok.io"
],
"showLoadingIndicator": false
}
The connector registration manifest (exported from outlook.office.com reg)
Connector is just registered, not published
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.3/MicrosoftTeams.schema.json",
"manifestVersion": "1.3",
"id": "76a7925f-e99f-4d9e-970b-b1bee2390f2c",
"version": "1.0.0",
"packageName": "com.tabappCon2",
"developer": {
"name": "Developer",
"websiteUrl": "https://48fb-80-233-63-141.ngrok.io",
"privacyUrl": "https://48fb-80-233-63-141.ngrok.io",
"termsOfUseUrl": "https://48fb-80-233-63-141.ngrok.io"
},
"description": {
"full": "tabappCon2",
"short": "tabappCon2"
},
"icons": {
"outline": "https://outlook.office.com/connectors/Content/Images/IncomingWebhook.jpg",
"color": "https://outlook.office.com/connectors/Content/Images/IncomingWebhook.jpg"
},
"connectors": [
{
"connectorId": "76a7925f-e99f-4d9e-970b-b1bee2390f2c",
"scopes": [
"team"
],
"configurationUrl": "https://48fb-80-233-63-141.ngrok.io/tabapplConnector/config.html"
}
],
"name": {
"full": "tabappCon2",
"short": "tabappCon2"
},
"accentColor": "#FFFFFF",
"validDomains": [
"https://48fb-80-233-63-141.ngrok.io"
],
"needsIdentity": "true"
}

AWS Lambda API Application .Net Core Not responding

I created an AWS Lambda Application API using AWS Toolkit for .Net Core 3.1. It has 2 Get request that expecting text JSON in a request body and returning text JSON as an output. It does not require any database connection or any other AWS resources. Locally everything works fine, all tests are passing. I publish my app to AWS account using AWS Toolkit which runs Cloud Formation setting file, again no problems, all passing. This creates my AWS Lambda API app with my API endpoint. However, when I try to use I am getting "403 Forbidden" errors:
Other thing I notice is that the default API Gateway type is Edge, I am unsure if that's making a problem. I would like to set it up to Private in cloud formation stuck from .Net Core level. I assume it is something to be change here:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "An AWS Serverless Application that uses the ASP.NET Core framework running in Amazon Lambda.",
"Resources": {
"AspNetCoreFunction": {
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "AES.Protocol::AES.Protocol.LambdaEntryPoint::FunctionHandlerAsync",
"Runtime": "dotnetcore3.1",
"CodeUri": "",
"MemorySize": 256,
"Timeout": 30,
"Role": null,
"Policies": [
"AWSLambdaFullAccess"
],
"Events": {
"ProxyResource": {
"Type": "Api",
"Properties": {
"Path": "/{proxy+}",
"Method": "ANY"
}
},
"RootResource": {
"Type": "Api",
"Properties": {
"Path": "/",
"Method": "ANY"
}
}
}
}
}
},
"Outputs": {
"ApiURL": {
"Description": "API endpoint URL for Prod environment",
"Value": {
"Fn::Sub": "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
}
}
}
}
The previous question related to this API might be helpful.
I manage to find a solution. It seems like CloudFront is not supporting GET request with "body". So changing "GET" to "POST" request fix the problem.

AWS Cloudformation creates task definition with no container definition

The following CloudFormation script creates a task definition but does not seem to create the container definition correctly. Can anyone tell me why?
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Test stack for troubleshooting task creation",
"Parameters": {
"TaskFamily": {
"Description": "The task family to associate the task definition with.",
"Type": "String",
"Default": "Dm-Testing"
}
},
"Resources": {
"TaskDefinition": {
"Type": "AWS::ECS::TaskDefinition",
"Properties": {
"Family": {
"Ref": "TaskFamily"
},
"RequiresCompatibilities": [
"EC2"
],
"ContainerDefinitions": [
{
"Name": "sample-app",
"Image": "nginx",
"Memory": 200,
"Cpu": 10,
"Essential": true,
"Environment": [
{
"Name": "SOME_ENV_VARIABLE",
"Value": "SOME_VALUE"
}
]
}
]
}
}
}
}
When I view the created task, there is no container listed in the builder view of task definition in aws.
The information is listed, however, under the json tab of the task definition:
Note that the above image is a subset of the info shown, not all of it.
The result of this is that, when the task is run in a cluster, it does run the image, but runs it without the environment variables applied. In addition, CF does not report any errors when creating this stack, or when running the created task.
Finally, the CloudFormation script is a cut down example of the 'real' script which has started exhibiting this same issue. That script has been working fine for around a year now, and, as far as I can see, there have been no changes to the script between it working and breaking.
I would greatly appreciate any thoughts or suggestions on this because my face is beginning to hurt from smashing it against this particular wall.
Turns out this was a bug in cloudformation that only occurred when creating a task definition using a script through the aws console. Amazon have now resolved this.

List PowerBI workspace collection keys from arm template

When using ARM templates to deploy various Azure components you can use some functions. One of them is called listkeys and you can use it to return through the output the keys that were created during the deployment, for example when deploying a storage account.
Is there a way to get the keys when deploying a Power BI workspace collection?
According to you mentioned link, if we want to use listKeys function, then we need to know resourceName and ApiVersion.
From the Azure PowerBI workspace collection get access keys API, we could get resource name
Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName} and API version "2016-01-29"
So please have a try to use the follow coding, it works for me correctly.
"outputs": {
"exampleOutput": {
"value": "[listKeys(resourceId('Microsoft.PowerBI/workspaceCollections', parameters('workspaceCollections_tompowerBItest')), '2016-01-29')]",
"type": "object"
}
Check the created PowerBI Service from Azure portal
Whole ARM template I used:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspaceCollections_tompowerBItest": {
"defaultValue": "tomjustforbitest",
"type": "string"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.PowerBI/workspaceCollections",
"sku": {
"name": "S1",
"tier": "Standard"
},
"tags": {},
"name": "[parameters('workspaceCollections_tompowerBItest')]",
"apiVersion": "2016-01-29",
"location": "South Central US"
}
],
"outputs": {
"exampleOutput": {
"value": "[listKeys(resourceId('Microsoft.PowerBI/workspaceCollections', parameters('workspaceCollections_tompowerBItest')), '2016-01-29')]",
"type": "object"
}
}
}

Connect AWS CodeDeploy to Github without using my Github user?

AWS documentation describes how you authenticate to Github using your browser, and that you're currently logged into Github as a valid user with permission to the repository you want to deploy from:
http://docs.aws.amazon.com/codedeploy/latest/userguide/github-integ.html#github-integ-behaviors-auth
Is there any way to setup CodeDeploy without linking my user and having a browser? I'd love to do this using webhooks on each repository and AWS API calls, but I'll make a Github 'service user' if I have to.
More examples:
http://blogs.aws.amazon.com/application-management/post/Tx33XKAKURCCW83/Automatically-Deploy-from-GitHub-Using-AWS-CodeDeploy
I'd love to use webhooks on my repo, or set them up myself, than permit AWS access to every repository on my Github account.
There does not appear to be an alternative to doing the OAuth flow in your browser at this point. If you're concerned about opening your whole Github account up to Amazon, creating a service user is probably the best approach, unfortunately it seems this user still needs administrative access to your repos to set up the integration.
After more research I realized my first answer is wrong, you can use AWS CLI to create a CodePipeline using a Github OAuth token. Then you can plug in your CodeDeploy deployment from there. Here's an example configuration:
{
"pipeline": {
"roleArn": "arn:aws:iam::99999999:role/AWS-CodePipeline-Service",
"stages": [
{
"name": "Source",
"actions": [
{
"inputArtifacts": [],
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"version": "1",
"provider": "GitHub"
},
"outputArtifacts": [
{
"name": "MyApp"
}
],
"configuration": {
"Owner": "myusername",
"Repo": "myrepo",
"Branch": "master",
"OAuthToken": "**************"
},
"runOrder": 1
}
]
},
{
"name": "Beta",
"actions": [
{
"inputArtifacts": [
{
"name": "MyApp"
}
],
"name": "CodePipelineDemoFleet",
"actionTypeId": {
"category": "Deploy",
"owner": "AWS",
"version": "1",
"provider": "CodeDeploy"
},
"outputArtifacts": [],
"configuration": {
"ApplicationName": "CodePipelineDemoApplication",
"DeploymentGroupName": "CodePipelineDemoFleet"
},
"runOrder": 1
}
]
}
],
"artifactStore": {
"type": "S3",
"location": "codepipeline-us-east-1-99999999"
},
"name": "MySecondPipeline",
"version": 1
}
}
You can create the pipeline using the command:
aws codepipeline create-pipeline --cli-input-json file://input.json
Make sure that the Github OAuth token has permissions admin:repo_hook and repo.
Reference: http://docs.aws.amazon.com/cli/latest/reference/codepipeline/create-pipeline.html
CodeDeploy and Github integration works based on Github Oauth. So to use the CodeDeploy and Github integration, you will have to trust CodeDeploy github application using your github account. Currently this integration will only work in your browser with a valid github account cause CodeDeploy application will always redirect back to CodeDeploy console to verify&finish the OAuth authentication process.
You can do it using this bash command
FROM LOCAL TO REMOTE
rsync --delete -azvv -e "ssh -i /path/to/pem" /path/to/local/code/* ubuntu#66.66.66.66:/path/to/remote/code
FROM REMOTE TO LOCAL
rsync --delete -azvv -e "ssh -i /path/to/pem" ubuntu#66.66.66.66:/path/to/remote/code/* /path/to/local/code
rsync checks file versions and updates the files that need to be update