This file contains 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
Get-AzNetworkSecurityGroup -Name $Name -ResourceGroupName $ResourceGroupName ` | |
| Add-AzNetworkSecurityRuleConfig -Name "ClientCommunicationtoAPIM" -Description "Client communication to API Management" -Access "Allow" -Protocol "tcp" -Direction "Inbound" -Priority 200 -SourceAddressPrefix "internet" -SourcePortRange "*" -DestinationAddressPrefix "VirtualNetwork" -DestinationPortRange (80,443) ` | |
| Add-AzNetworkSecurityRuleConfig -Name "ManagementEndpointForAzurePortalAndPowerShell" -Description "Management endpoint for Azure portal and PowerShell" -Access "Allow" -Protocol "tcp" -Direction "Inbound" -Priority 210 -SourceAddressPrefix "ApiManagement" -SourcePortRange "*" -DestinationAddressPrefix "VirtualNetwork" -DestinationPortRange (3443) ` | |
| Add-AzNetworkSecurityRuleConfig -Name "AzureInfrastructureLoadBalancer" -Description "Azure Infrastru |
This file contains 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
# Get Azure VMs with no marketplace image | |
Get-AzVm | Where-Object {!($_.StorageProfile.ImageReference)} |
This file contains 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
#Redirect example.com/subpage1 to example.com/subpage1.html, example.com/subpage2 to example.com/subpage2.html | |
#And so on | |
#Snippet from the nginx config file | |
#Tested in an Azure PHP WebApp | |
#Redirect /page to /page.html | |
location / { | |
try_files $uri $uri/index.html $uri/index.php $uri.html $uri/ ; | |
} |
This file contains 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
<# | |
.SYNOPSIS | |
Find empty Azure App Service Plans | |
.DESCRIPTION | |
Find Azure App Service Plans in the current Azure Context with no App Services associated with them. | |
These empty App Service Plans will potentially be incurring unneccessary charges. | |
.EXAMPLE | |
#Return a list of Empty App Service Plans in the current Azure Context | |
Get-AzEmptyAppServicePlans | |
.EXAMPLE |
This file contains 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
#Return a List of Azure VMs (in the current context) which are not backed up by Recovery Services Vaults | |
$BackupStatus=@() | |
$BackupStatus=foreach ($VM in Get-AzVM) { $VM | Select-Object Name, ResourceGroupName, @{Name="BackedUp";Expression={(Get-AzRecoveryServicesBackupStatus -Name $VM.Name -ResourceGroupName $VM.ResourceGroupName -Type AzureVM).BackedUp }}} | |
$BackupStatus | Where {$_.BackedUp -eq $false} | Select Name, ResourceGroupName |
This file contains 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
#Create Resources for testing AZCopy in a Web App | |
#See https://isjw.uk/post/azure/azure-app-service-azcopy/ | |
#Creates an Azure Resource Group containing an App Service Plan, a Web App, and a Storage Account. | |
#Set some parameters | |
$location="NorthEurope" | |
$resourceGroupName= "azcopytest-rsg" | |
$webAppName="azcopytest-web" | |
$appServicePlanName="azcopytest-asp" | |
$storageAccountName=("azcopyteststo"+((New-Guid) -replace ("-",""))).Substring(0,20) |
This file contains 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 default location for new resource groups. | |
$PSDefaultParameterValues.Add("New-AzResourceGroup:Location","uksouth") | |
#Create a Resource Group without specifying the location parameter | |
New-AZResourceGroup -Name "test-rsg" |
This file contains 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
Get-VMHost | Select-Object Name, ` | |
@{Name="Vendor";E={$_.ExtensionData.Hardware.SystemInfo.Vendor}}, ` | |
@{Name="Model";E={$_.ExtensionData.Hardware.SystemInfo.Model}}, ` | |
@{Name="SerialNumber";E={$_.ExtensionData.Hardware.SystemInfo.SerialNumber}} ` | |
| Sort-Object -Property Name |