This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param ( | |
| [string]$ParentFolder | |
| ) | |
| # Get the list of child folders | |
| $folders = Get-ChildItem -Path $ParentFolder -Directory | |
| # Create a custom object to store the results | |
| $results = @() | |
| foreach ($folder in $folders) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //https://www.blueboxes.co.uk/working-with-tags-in-azure-resource-graph-explorer | |
| ResourceContainers | |
| | where type =~ 'microsoft.resources/subscriptions/resourcegroups' | |
| | mvexpand tags | |
| | extend tagKey = tostring(bag_keys(tags)[0]) | |
| | extend tagValue = tostring(tags[tagKey]) | |
| | project name, tags, tagKey, tagValue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $SubscriptionName = "subName" | |
| $resourceGroupName = "rgName" | |
| $routeServerName = "ARSName" | |
| $peerName = "peerName" | |
| Select-AzSubscription -SubscriptionName $SubscriptionName | |
| $routerServerPeer = Get-AzRouteServerPeer -ResourceGroupName $resourceGroupName -RouteServerName $routeServerName -PeerName $peerName | |
| Get-AzRouteServerPeerLearnedRoute -InputObject $routerServerPeer | |
| #Get-AzRouteServerPeerLearnedRoute -ResourceGroupName $resourceGroupName -RouteServerName $routeServerName -PeerName $peerName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Por ejemplo, para ver el tráfico de navegación de una IP en particular: | |
| AzureDiagnostics | |
| | where Category == "AzureFirewallApplicationRule" | |
| | parse msg_s with Protocol " request from " SourceIP ":" SourcePortInt:int " " TempDetails | |
| | parse TempDetails with "was " Action1 ". Reason: " Rule1 | |
| | parse TempDetails with "to " FQDN ":" TargetPortInt:int ". Action: " Action2 "." * | |
| | parse TempDetails with * ". Rule Collection: " RuleCollection2a ". Rule:" Rule2a | |
| | parse TempDetails with * "Deny." RuleCollection2b ". Proceeding with" Rule2b | |
| | extend SourcePort = tostring(SourcePortInt) | |
| | extend TargetPort = tostring(TargetPortInt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set the storage account context | |
| $storageAccount = Get-AzStorageAccount -ResourceGroupName <resource-group-name> -Name <storage-account-name> | |
| $ctx = $storageAccount.Context | |
| # Get the list of containers | |
| $containers = Get-AzStorageContainer -Context $ctx | |
| # Create an empty array to store the list of blobs | |
| $blobs = @() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #region Runbook_Variables | |
| $ErrorActionPreference = "Continue" | |
| $filename = "AHUB.csv" | |
| #endregion Runbook_Variables | |
| #region Runbook_Collection_Logic | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| workflow ShutDownStartByTag | |
| { | |
| Param( | |
| [Parameter(Mandatory=$true)] | |
| [String] | |
| $TagName, | |
| [Parameter(Mandatory=$true)] | |
| [String] | |
| $TagValue, | |
| [Parameter(Mandatory=$true)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // VMs with the most on-prem traffic in the last hour (flows) | |
| AzureNetworkAnalytics_CL | |
| | where SubType_s == "FlowLog" and FlowType_s == "S2S" | |
| | mvexpand vm = pack_array(VM1_s, VM2_s) to typeof(string) | |
| | where isnotempty(vm) | |
| | extend traffic = AllowedInFlows_d + DeniedInFlows_d + AllowedOutFlows_d + DeniedOutFlows_d // For bytes use: | extend traffic = InboundBytes_d + OutboundBytes_d | |
| | make-series TotalTraffic = sum(traffic) default = 0 on FlowStartTime_t from ago(1h) to now() step 1m by vm | |
| | render timechart | |
| // VMs with the most on-prem traffic in the last hour (bytes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## this script should be executed in poweershell, but previously you have to logon to az cli | |
| # az login | |
| $AllSubs = az account list | convertfrom-json | select-object Name, Id | |
| $ObjectsOutput = @() | |
| foreach ($sub in $AllSubs){ | |
| #Cambio de Suscripción | |
| az account set --subscription $sub.Id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| import os | |
| from azure.cli.core import get_default_cli | |
| def main(): | |
| commnd = f'login --identity' | |
| exAzCli(commnd, False) #login to azure cli using service principal credentials | |
| subs = exAzCli('account list --all', False) #executing cli command |
NewerOlder