Skip to content

Instantly share code, notes, and snippets.

View hkarthik7's full-sized avatar
🎯
Focusing

Harish Karthic hkarthik7

🎯
Focusing
View GitHub Profile
function Export-AzureWebAppLogFiles {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$AppServiceName,
[Parameter(Mandatory = $true)]
[string]
$ResourceGroupName,
@hkarthik7
hkarthik7 / Export-Html.ps1
Created February 18, 2021 16:43
Script to export the results as html report
function Export-Html {
[CmdletBinding(DefaultParameterSetName='Page')]
param(
[Parameter(ValueFromPipeline=$true)]
[psobject]
${InputObject},
[Parameter(Position=0)]
[System.Object[]]
@hkarthik7
hkarthik7 / LogParser.ps1
Created February 18, 2021 16:42
LogParser script to parse http logs from azure web app
function LogParser {
# this comes in analysis section; So, need a place to store the files.
# We need a separate function to list this.
# Intended to run in pipeline
$report = @()
$files = Get-ChildItem -Path $PWD.Path -Filter "*.log"
foreach ($file in $files) {
$contents = Get-Content -Path $file.FullName | Select-Object -Skip 2
@hkarthik7
hkarthik7 / Export-AzureWebAppLogFiles.ps1
Created February 18, 2021 16:20
Downloads https log files from SCM API
function Export-AzureWebAppLogFiles {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$AppServiceName,
[Parameter(Mandatory = $true)]
[string]
$ResourceGroupName,
@hkarthik7
hkarthik7 / Remove-AzureSqlBacPacFiles.ps1
Created September 11, 2020 13:51
Remove-AzureSqlBacPacFiles
function Remove-AzureSqlBacPacFiles {
[CmdletBinding()]
param (
[Parameter(Mandatory = $false, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[ValidateRange(1,180)]
[int] $RetentionPeriod = 15
)
begin {
# initialise function variable
# import module
Import-Module psAzD
# set default parameters
$params = @{
Organization = "myOrganization"
Project = "Test"
PersonalAccessToken = "Azure DevOps Personal Access Token here"
}
Set-AzDDefaultParameters @params
@hkarthik7
hkarthik7 / AzSqlDB.ps1
Last active September 8, 2020 08:49
Export and Import automation of Azure Sql database
# Set-PSDBDefaults can be used to set the subscription in current context and allows you to set the function
# default parameters such as resource group name, server name and database name
#region Export database
Set-PSDBDefaults -Subscription "mySubscription01"
$password = Get-PSDBKVSecret -VaultName "kv-01" -SecretName "sqlpassword"
$exportParams = @{