Skip to content

Instantly share code, notes, and snippets.

View kasunkv's full-sized avatar
💭
I may be slow to respond.

Kasun Kodagoda kasunkv

💭
I may be slow to respond.
View GitHub Profile
@kasunkv
kasunkv / arm-template.json
Created August 6, 2018 15:00
Create Resource Group using ARM Template.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"rgLocation": {
"type": "string",
"defaultValue": "Southeast Asia"
},
"rgName": {
"type": "string",
@kasunkv
kasunkv / deploy-template.ps1
Created August 6, 2018 15:03
Subscription level deployment using Azure CLI
az deployment create --name <deployment_name> --location <resource_location> --template-file .\azuredeploy.json
@kasunkv
kasunkv / bash.sh
Created October 24, 2018 15:25
Install sentry
npm install @sentry/node@4.2.1 --save
@kasunkv
kasunkv / task.ts
Created October 24, 2018 15:32
Import and Initialize Sentry
import * as sentry from '@sentry/node';
sentry.init({
dsn: 'https://a971xxxxxxxxxxxxxxxxxxx0c074be@sentry.io/1xxxxx1',
release: '1.0.1'
});
@kasunkv
kasunkv / task.ts
Created October 24, 2018 15:46
Send exceptions to sentry.
try {
// Your code
} catch (err) {
sentry.captureException(err);
}
@kasunkv
kasunkv / Monitoring.ts
Created October 24, 2018 15:50
Monitoring Class encapsulating Sentry.
import * as sentry from '@sentry/node';
import { IMonitoring } from './interfaces/IMonitoring';
import { SentryEvent } from '@sentry/node';
export class Monitoring implements IMonitoring {
constructor() {
}
configure(): void {
@kasunkv
kasunkv / create-tag.ps1
Created January 4, 2019 06:02
Create Azure Resource Tag
Set-AzureRmResourceGroup -Name "Tags-DEV-Web" -Tag @{ Department = "Development" }
@kasunkv
kasunkv / update-tags.ps1
Created January 4, 2019 06:08
Update/Add New Azure Resource Tags.
$tags = (Get-AzureRmResourceGroup -Name "Tags-DEV-Web").Tags
$tags.Add("Owner", "John Smith")
Set-AzureRmResourceGroup -Tag $tags -Name "Tags-DEV-Web"
@kasunkv
kasunkv / add-update-tags.ps1
Created January 4, 2019 08:29
Add/Update Tags for Other Azure Resources
$res = Get-AzureRmResource -ResourceName "kvktagsweb" -ResourceGroupName "Tags-DEV-Web"
$res.Tags.Add("App", "WebApp") # This will only work if the resource already has tags.
Set-AzureRmResource -Tag $res.Tags -ResourceId $res.ResourceId -Force
@kasunkv
kasunkv / add-tag.ps1
Last active January 4, 2019 12:32
Add Tags using Azure CLI
# Add tag to Azure Resource Group
az group update --name "Tags-PRD-Web" --set tags.Department=Operations