Skip to content

Instantly share code, notes, and snippets.

View GTRekter's full-sized avatar
🌎
안녕하세요

Ivan (이반) Porta GTRekter

🌎
안녕하세요
View GitHub Profile
@GTRekter
GTRekter / schema.json
Created January 20, 2021 12:12
JSON schema
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/object1610484731.json",
"title": "root",
"type": "object",
"required": [
"teams"
],
"properties": {
@GTRekter
GTRekter / sample.json
Created January 20, 2021 12:14
Sample JSON
{
"teams":[
{
"displayName": "Public team1",
"visibility": "Public",
"users": [
{
"email":"User1@domain.com",
"role":"Owner"
},
Param(
[Parameter(Position=0)]
[string]$Office365Username,
[Parameter(Position=1)]
[string]$Office365Password,
[Parameter(Position=2)]
[string]$TeamsFilePath
)
Write-Verbose "Importing modules"
@GTRekter
GTRekter / AzDO-Terraform-Plan-PR.yaml
Last active January 23, 2024 14:11
This snippet contains the steps to generate a terraform plan and post it as a comment of a pull request in Azure DevOps
- script: |
terraform plan -out tf.tfplan
displayName: Generate Terraform plan
- script: |
terraform show -no-color tf.tfplan > $(Agent.TempDirectory)/tf.txt
displayName: Convert Terraform plan to text
- bash: |
cd $(Agent.TempDirectory)
@GTRekter
GTRekter / setup.sh
Last active April 13, 2023 14:38
The script is designed to automate the assignment of security groups to environments.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"pipeline": {
"environments": [
{
"name": "Connectivity",
"description": "Connectivity production environment",
"security_groups_name": [
@GTRekter
GTRekter / setup.sh
Last active April 13, 2023 06:19
The script is designed to automate the process of creating an Azure Resource Manager (Azurerm) and GitHub service connection. The script first checks if the service connections already exist, and if they do not, it creates them.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"pipeline": {
"service_endpoints": [
{
"azurerm": [
{
"name": "Azure",
@GTRekter
GTRekter / setup.sh
Created April 13, 2023 14:45
The script is designed to automate the creation of Azure DevOps agent pools. It will process both self-hosted and Azure-hosted pools.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"agent_pools":
[
{
"self_hosted":[
{
"name": "Default",
@GTRekter
GTRekter / setup.sh
Last active April 14, 2023 07:01
This script checks if an Azure Active Directory is already connected to an organization in Azure DevOps. If it is, it skips the connection process. If it is not, it connects the organization to the Azure Active Directory.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"organization": {
"name": "portaivan",
"azure_active_directory": {
"tenant_id": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
@GTRekter
GTRekter / setup.sh
Created April 15, 2023 06:58
This is a bash script that configures several organization policies for a specified Azure DevOps organization. The script makes use of the Azure DevOps REST API to perform PATCH requests on the different policies. The policies that are being configured include disallowing third-party application access via OAuth, disallowing SSH authentication, …
PAT=""
ORG_NAME=""
DEFAULT_JSON={
"organization": {
"policies": {
"disallow_third_party_application_access_via_oauth": false,
"disallow_ssh_authentication": false,
"log_audit_events": true,
"allow_public_projects": true,
"additional_protections_public_package_registries": true,
@GTRekter
GTRekter / setup.sh
Created April 15, 2023 08:03
This script configures organization settings in Azure DevOps using cURL commands. It sets various policies for an organization such as disabling anonymous access badges, limiting variables set at queue time, and limiting job authorization scope to the current project for non-release pipelines.
PAT=""
ORG_NAME=""
DEFAULT_JSON='{
"organization": {
"settings": {
"disable_anonymous_access_badges": true,
"limit_variables_set_queue_time": false,
"limit_job_authorization_current_project_non_release_pipelines": false,
"limit_job_authorization_current_project_release_pipelines": false,
"protect_access_repositories_yaml_pipelines": false,