Skip to content

Instantly share code, notes, and snippets.

package gitlab
import (
"io/ioutil"
"log"
"net/http"
)
const (
timeout = 30
ALTER USER user_name IDENTIFIED BY new_password;
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
# Configure the AWS Provider
$uname = 'USERNAME'
$passwd = 'PASSWORD'
$TowerApiUrl = 'https://<REPLACE_WITH_TOWER_URL>/api/v2'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Authorization = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$uname`:$passwd"))
$MeUri = $TowerApiUrl + '/me/'
$MeResult = Invoke-RestMethod -Uri $MeUri -Headers @{ "Authorization" = "Basic $Authorization" ; "Content-Type" = 'application/json'} -ErrorAction Stop
<#
.SYNOPSIS
Delete default WAF settings.
.DESCRIPTION
This script deletes the default setting created when the WAF is deployed using building blocks.
.EXAMPLE
.\cleanWAF.ps1 -WAFName WAFTEST01
#>
param(
<#
.SYNOPSIS
Set IAM role assigments to specific resources.
.DESCRIPTION
The scripts gets the identity object id from the resource group so you need to ne added it before
.EXAMPLE
.\roleAssigment.ps1 -SubscriptionName CTSBP-PROD-SUB -ResourceGroupName UWUPIERSG01 -IdentityList IT-Team,CT-USER -ResourceList WEBAPPNAME01,STORAGEACC01 -RoleName Contributor
.\roleAssigment.ps1 -SubscriptionName CTSBP-TEST-SUB -ResourceGroupName UWUPIERSG01 -IdentityList CT-USER -ResourceList WEBAPPNAME01 -RoleName Reader
#>
@juanesech
juanesech / checkRoleAssigment.ps1
Last active April 15, 2020 18:49
Check the role assigment for a azure resource given the id and Assigment name
Get-AzRoleAssignment -Scope $webAppId | where {$_.DisplayName -match "CTP-TaxtobinII-DEV" -or $_.DisplayName -match "IT-TAX_ASKTOBIN_MSP01-Team" }
@juanesech
juanesech / selectAzSubscription
Last active April 15, 2020 14:38
Select a azure subscription that contains a string pattern in his name
$subsNames = @(Get-AzSubscription | select name)
foreach ($name in $subsNames) {
if ($name -match "USWE") {
Get-AzSubscription -SubscriptionName $name | Set-AzContext
#Commands to run into subscription
Get-AzResourceGroup
}
}
param ($server, $u = "Student", $p = "Pa55w.rd1234")
echo "Connecting to $Server"
$User=$u
$Password=$p
cmdkey /generic:TERMSRV/$server /user:$User /pass:$Password
mstsc /v:$server
for i in $buckets; do aws s3 rm --recursive s3://$i; done