Skip to content

Commit

Permalink
updates to add backup restore, tags everything, loadbalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
deltadan committed Dec 5, 2018
1 parent 7f23488 commit ff5eef5
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
20 changes: 20 additions & 0 deletions networking/loadbalancer/loadbalancer-basic-create-cli.azcli
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
#!/bin/bash
###########################################################################################
# Stormtrooper Project
# MIT License - https://github.com/deltadan/stormtrooper
# Copyright (c) 2018 Dan Patrick - @deltadan
#
#Script Purpose
# - Creating a new Azure Load Balancer with a Public IP Address
# - Locate VMs with Restore Point
# - Delete Restore Points
# - Must provide the name of the resource group - looks like: AzureBackupRG_eastus_1
# (these names are in portal, but show no resources)
###########################################################################################
RG=STRG
nsgName=STVM1-NSG
rule1Name=PORT_HTTP_80
nicName=STVM1-NIC



# Creating a Public IP Address
az network public-ip create -g CLIRefRG -n CLIRefLB-PublicIP --dns-name CLIReflb --allocation-method Static

Expand Down
24 changes: 24 additions & 0 deletions resource/delete/resource-delete-backup-restore.azcli
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
###########################################################################################
# Stormtrooper Project
# MIT License - https://github.com/deltadan/stormtrooper
# Copyright (c) 2018 Dan Patrick - @deltadan
#
#Script Purpose
# - When moving VMs between resource groups or subscriptions you must remove restore points
# - Locate VMs with Restore Point
# - Delete Restore Points
# - Must provide the name of the resource group - looks like: AzureBackupRG_eastus_1
# (these names are in portal, but show no resources)
###########################################################################################

rg=AzureBackupRG_regionNameHere_1
array=(backupJob1 backupJob2)

for backupjobs in "${array[@]}"
do
az resource delete -g $rg \
-n $backupjobs \
--resource-type "Microsoft.Compute/restorePointCollections" \
--verbose
done
24 changes: 24 additions & 0 deletions resource/tags/resource-tag.azcli
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
###########################################################################################
# Stormtrooper Project
# MIT License - https://github.com/deltadan/stormtrooper
# Copyright (c) 2018 Dan Patrick - @deltadan
#
#Script Purpose
# - Gets all Tags on All Resource Groups
# - Adds the RG tags along with any exsisting resource Tags to All resources in subscription
###########################################################################################
rg=test
groups=$(az group list --query [].name --output tsv)
for rg in $groups
do
jsontag=$(az group show -n $rg --query tags) || true
t=$(echo $jsontag | tr -d '"{},' | sed 's/: /=/g') || true
r=$(az resource list -g $rg --query [].id --output tsv) || true
for resid in $r
do
jsonrtag=$(az resource show --id $resid --query tags) || true
rt=$(echo $jsonrtag | tr -d '"{},' | sed 's/: /=/g') || true
az resource tag --tags $t$rt --id $resid || true
done
done

0 comments on commit ff5eef5

Please sign in to comment.