Skip to content

Instantly share code, notes, and snippets.

View ievgen-pavlenko's full-sized avatar

Ievgen Pavlenko ievgen-pavlenko

  • GlobalLogic Ukraine
  • Ukraine, Kyiv
View GitHub Profile
@ievgen-pavlenko
ievgen-pavlenko / pipeline.yaml
Created May 13, 2023 06:16
This YAML script is an Azure DevOps pipeline configuration for building, testing, and deploying an ASP.NET Core application to both Test and Production environments, with the Production deployment requiring a successful Test deployment and utilizing slot swapping for zero-downtime deployment.
trigger:
- main
stages:
- stage: Build
displayName: 'Build and Test'
jobs:
- job: BuildJob
displayName: 'Build Job'
pool:
@ievgen-pavlenko
ievgen-pavlenko / vnet.bicep
Created March 19, 2023 12:34
This Bicep file automates the creation of a fully integrated Azure infrastructure by creating an app service plan, app service, key vault, storage account, and virtual network (VNet) and associating them all with the VNet.
param location string = resourceGroup().location
param appServiceName string = 'app-${uniqueString(resourceGroup().id)}'
param appServicePlanName string = 'AppServicePlan-${appServiceName}'
param keyVaultName string = 'test-kv-${uniqueString(resourceGroup().id)}'
param storageAccountName string = 'teststg${uniqueString(resourceGroup().id)}'
param sku string = 'S1'
param vnetName string = 'vnet'
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
name: appServicePlanName
@ievgen-pavlenko
ievgen-pavlenko / create-storage-account.sh
Created February 19, 2023 12:04
Create storage account by Azure CLI
az storage account create -n mystorageaccount -g MyResourceGroup --kind StorageV2 -l westeurope
@ievgen-pavlenko
ievgen-pavlenko / get_access_token_from_kudu.ps1
Created November 22, 2022 14:02
Get access token from KuDu shell
#User Assigned Managed Identity
$ProgressPreference = "SilentlyContinue"
$clientId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
$headers=@{"X-IDENTITY-HEADER"=$env:IDENTITY_HEADER}
$resourceUri = ‘https://management.azure.com/'
$uri = "$($env:IDENTITY_ENDPOINT)?api-version=2019-08-01&client_id=$clientId&resource=$resourceUri"
$response = Invoke-WebRequest -UseBasicParsing -Uri $uri -Headers $headers
$content = $response.Content | ConvertFrom-Json
$content.access_token
@ievgen-pavlenko
ievgen-pavlenko / get_access_token_from_vm.ps1
Created November 22, 2022 13:58
Get access token from VM
#User Assigned Managed Identity
$clientId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
$resourceUri = 'https://management.azure.com/'
$uri = "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&client_id=$clientId&resource=$resourceUri"
$response = Invoke-WebRequest -Uri $uri -Method GET -Headers @{Metadata="true"}
$content = $response.Content | ConvertFrom-Json
$content.access_token
#System Assigned Managed Identity
$resourceUri = 'https://management.azure.com/'