Skip to content

Instantly share code, notes, and snippets.

View papeMK2's full-sized avatar

Tsubasa Yoshino papeMK2

  • Sigma Consulting
  • Japan Tokyo
View GitHub Profile
@papeMK2
papeMK2 / PowerShell_Profile.ps1
Last active December 6, 2023 08:52
My PowerShell Profile
# oh my posh
oh-my-posh init pwsh | Invoke-Expression
# Terminal icons
Import-Module -Name Terminal-Icons
# PSReadLine
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
@papeMK2
papeMK2 / ListApplicationInsightsWithClassicOrNot.ps1
Created July 20, 2023 08:30
List application insights with classic or not
(az group list | ConvertFrom-Json) `
| select name `
| foreach { (az monitor app-insights component show -g $_.name | ConvertFrom-Json) } `
| select @{Name='name';Expression={$_.name}}, @{ Name = 'mode'; Expression = {$_.ingestionMode}}, @{ Name = 'IsClassic'; Expression = {$_.ingestionMode -ne 'LogAnalytics'}}
@papeMK2
papeMK2 / GetAppInsightsNameWithRG.ps1
Created July 20, 2023 07:12
List app insights with resource groups
(az group list | ConvertFrom-Json) | select name | foreach { (az monitor app-insights component show -g $_.name | ConvertFrom-Json) | select name}
@papeMK2
papeMK2 / GetResourceGroupNames.ps1
Created July 20, 2023 06:45
Get resource group name list
(az group list | ConvertFrom-Json) | Select-Object name
@papeMK2
papeMK2 / main.bicep
Created June 6, 2023 02:58
Get App Configuration Connection string
targetScope = 'resourceGroup'
@allowed([
'Primary'
'Secondary'
'Primary Read Only'
'Secondary Read Only'
])
param connectionStringType string = 'Primary Read Only'
@papeMK2
papeMK2 / appService.bicep
Created May 12, 2023 05:38
App Service with bicepparam
param location string = resourceGroup().location
var suffix = guid('guid')
resource plan 'Microsoft.Web/serverfarms@2022-03-01' = {
name: 'plan-demo-lab-${suffix}'
location: location
kind: 'app'
sku: {
name: 'B1'
@papeMK2
papeMK2 / APIManagement_RedirectToAnyUrl.xml
Last active March 20, 2023 09:37
If backend return status code 500, redirect to any your url sample.
<policies>
<inbound>
<base />
<set-backend-service id="apim-generated-policy" backend-id="{your backend id}" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
resource firewall 'Microsoft.Sql/servers/firewallRules@2022-08-01-preview' = {
name: 'AllowAllWindowsAzureIps'
parent: sqlServer
properties: {
startIpAddress: '0.0.0.0'
endIpAddress: '0.0.0.0'
}
}
param name string
resource app 'Microsoft.Web/sites@2021-03-01' existing = {
name: name
}
resource slotSetting 'Microsoft.Web/sites/config@2022-03-01' = {
name: 'slotConfigNames'
parent: app
properties: {
@papeMK2
papeMK2 / AppServiceWithAppConfigurationRole.bicep
Created February 10, 2023 06:53
Create app service and add app configuration data reader role.
resource plan 'Microsoft.Web/serverfarms@2022-03-01' = {
name: 'plan-demo-lab'
location: resourceGroup().location
kind: 'app'
sku: {
name: 'B1'
}
}
resource app 'Microsoft.Web/sites@2022-03-01' = {