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
| # Create and initialise the TokenPass object | |
| $ConcurrencyToken = [TokenPass]::new() | |
| # Set the names of the two Azure Automation Variables we will use | |
| $ConcurrencyToken.TokenName = "TokenPass" | |
| $ConcurrencyToken.ReservationTokenName = "TokenPassReservation" | |
| # Set a value for the token which will be passed back and forth | |
| $ConcurrencyToken.TokenValue = "TOKENPASS” |
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
| class TokenPass { | |
| [string]$TokenName | |
| [string]$TokenValue | |
| [string] $TempToken = $null | |
| [string] $TempReservationToken = $null | |
| [string] $ReservationTokenName | |
| hidden [int] $CountUp = 0 | |
| [int] $RetryNum = 2400 | |
| [string] $TokenSessionGuid = (New-Guid).Guid | |
| [string] $TokenHolder |
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
| # Create and initialise the Mutex object | |
| $Mutex = [System.Threading.Mutex]::new($false, "MyMutex") | |
| # Wait for/get the Mutex | |
| $Mutex.WaitOne() | |
| # Do some things | |
| New-ImportantThing -importance maximum | |
| # Release the Mutex |
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
| $uri = "https://tapi.telstra.com/v2/messages/mms" | |
| $subject = "awww" | |
| $body = [ordered]@{ | |
| "to"=$to; | |
| "subject"=$subject; | |
| "replyRequest"=$false; | |
| MMSContent = @( | |
| [ordered]@{ | |
| "type"="image/png"; |
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
| Invoke-RestMethod -Uri $uri -ContentType "application/json" -Headers @{"Authorization"="Bearer $access_token"} -Method GET |
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
| $to = "+61412345678" | |
| $validity = "60" | |
| $message = "On average, cats spend 2/3 of every day sleeping. That means a nine-year-old cat has been awake for only three years of its life" | |
| $body = @{"to"=$to;"validity"=$validity;"body"="$message"} | |
| $body = $body | ConvertTo-JSON -depth 99 | |
| $uri = "https://tapi.telstra.com/v2/messages/sms" | |
| Invoke-RestMethod -Uri $uri -ContentType "application/json" -Headers @{"Authorization"="Bearer $access_token"} -Method POST -Body $Body |
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
| $body = "{}" | |
| $uri = "https://tapi.telstra.com/v2/messages/provisioning/subscriptions" | |
| Invoke-RestMethod -Uri $uri -ContentType "application/json" -Headers @{"Authorization"="Bearer $access_token"} -Method POST -Body $Body |
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
| $client_key = "<your client key>" | |
| $client_secret = "<your secret>" | |
| $body = "grant_type=client_credentials&client_id=$client_key&client_secret=$client_secret&scope=NSMS" | |
| $Authorization = Invoke-RestMethod "https://tapi.telstra.com/v2/oauth/token" -Method POST -ContentType "application/x-www-form-urlencoded" -Body $body -ErrorAction STOP | |
| $access_token = $Authorization.access_token |
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
| { | |
| "policyRule": { | |
| "if": { | |
| "allOf": [ | |
| { | |
| "field": "type", | |
| "equals": "Microsoft.Compute/virtualmachines" | |
| }, | |
| { | |
| "field": "tags.compliance", |
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
| [{ | |
| "subject": "/subscriptions/ffffffff-6666-4444-bbbb-999999999999/resourcegroups/rg-azpolicy/providers/Microsoft.Compute/virtualMachines/VM01", | |
| "eventType": "Microsoft.Resources.ResourceWriteSuccess", | |
| "eventTime": "2018-10-29T05:13:54.8681093Z", | |
| "id": "b1d0f685-e55a-496b-a40d-12ba12e3870c", | |
| "data": { | |
| "authorization": { | |
| "scope": "/subscriptions/ffffffff-6666-4444-bbbb-999999999999/resourceGroups/rg-azpolicy/providers/Microsoft.Compute/virtualMachines/VM01", | |
| "action": "Microsoft.Compute/virtualMachines/write", | |
| "evidence": { |
NewerOlder