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
| function WithRetry { | |
| param ( | |
| [Parameter(Mandatory = $true, ValueFromPipeline = $true)] | |
| [ValidateNotNull()] | |
| [ScriptBlock] $Command, | |
| [Parameter(Mandatory = $false)] | |
| [int]$RetryCount = 3 | |
| ) | |
| Write-Host "Retry Injection Scope" |
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
| #requires -Module Az.Sql | |
| #requires -Module Az.Monitor | |
| <# | |
| .DESCRIPTION | |
| When running a reindex on a Sql database sometime the fragmentation is so bad it will grow the database to the max size before finishing. | |
| This example shows how to attach monitoring to an action. | |
| .EXAMPLE | |
| $db = Get-AzSqlDatabase -ResourceGroupName <ResourceGroupName> -ServerName <ServerName> -DatabaseName <DatabaseName> |
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
| targetScope = 'subscription' | |
| param location string = deployment().location | |
| param uniqueDeploymentId string = newGuid() | |
| resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = { | |
| name: 'my-rg' | |
| location: location | |
| } |
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
| $Script:cache ??= [ordered]@{} | |
| <# | |
| .EXAMPLE | |
| Import-Module .\Az.Module.Cache.psm1 | |
| $servers = Get-CachedItem -ValueFactory { Get-AzResource -ResourceType "Microsoft.Sql/servers" } -Verbose | |
| #> | |
| function Get-CachedItem { | |
| param( | |
| [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
| using namespace System.Management.Automation | |
| <# | |
| .DESCRIPTION | |
| This example uses enums so we can match based on type instead of strings | |
| Also, IValidateSet will pick up new additions automagically ^_^ | |
| #> | |
| enum Command { | |
| Publish | |
| Download | |
| NotImplementedWillThrow |
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
| <# | |
| .EXAMPLE | |
| $db = Get-AzSqlDatabase -ResourceGroupName <ResourceGroupName> -ServerName <ServerName> -DatabaseName <DatabaseName> | |
| Get-AzSqlDatabaseSchema -ResourceId $db.ResourceId | |
| #> | |
| function Get-AzSqlDatabaseSchema { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] | |
| [string]$ResourceId |
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
| import { getSubnets, Subnet, sliceSubnet } from 'networkUtils.bicep' | |
| var network = getSubnets('10.0.0.0', 20, 24) | |
| var sliced = sliceSubnet(network[0], 25) | |
| output sliced Subnet[] = sliced // result in output.sliced.json | |
| output network Subnet[] = take(network, 3) // result in output.network.json |
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
| type SubnetRange = { | |
| start: int | |
| end: int | |
| cidr: string | |
| } | |
| var subnets = loadJsonContent('subnets.json') | |
| var addressPrefixes = map(subnets, s => s.addressPrefix) |
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
| <Project> | |
| <PropertyGroup> | |
| <!-- All the identifiers to target --> | |
| <RuntimeIdentifiers>win-x64;linux-x64;osx-arm64</RuntimeIdentifiers> | |
| <BicepCmdBase>bicep publish-extension</BicepCmdBase> | |
| <BicepCmdOsx>--bin-osx-arm64 "$(MSBuildProjectDirectory)/bin/$(Configuration)/$(TargetFramework)/osx-arm64/publish/$(AssemblyName)"</BicepCmdOsx> | |
| <BicepCmdLinux>--bin-linux-x64 "$(MSBuildProjectDirectory)/bin/$(Configuration)/$(TargetFramework)/linux-x64/publish/$(AssemblyName)"</BicepCmdLinux> | |
| <BicepCmdWin>--bin-win-x64 "$(MSBuildProjectDirectory)/bin/$(Configuration)/$(TargetFramework)/win-x64/publish/$(AssemblyName).exe"</BicepCmdWin> | |
| <BicepCmdTarget>--target "$(MSBuildProjectDirectory)/bin/$(AssemblyName)"</BicepCmdTarget> |
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
| import { overrideMatchValues } from './helpers.bicep | |
| param routingRuleSetsOptions = [ | |
| { | |
| name: corRuleSet.name | |
| routingRules: [ | |
| { | |
| name: corsRule.name | |
| properties: { | |
| order: corsRule.properties.order |
OlderNewer