Skip to content

Instantly share code, notes, and snippets.

@kdemanuele
kdemanuele / azure_function.bicep
Last active Jul 21, 2021
Creating an Azure Function with Source Code as part of Bicep script
View azure_function.bicep
param LocationCode string
resource Storage 'Microsoft.Storage/storageAccounts@2021-04-01' = {
name: 'stor${LocationCode}labfunction'
location: resourceGroup().location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
properties: {
View Setup-Storage-Behind-VPN.ps1
## Initialising Variables
$AzureEnvironment = [PSCustomObject]@{
Location = 'North Europe'
Code = 'neu'
}
$Tags = @{
scope = 'training'
practice = 'VPN Access to Storage'
@kdemanuele
kdemanuele / Disable_PSRemoting.ps1
Created Dec 30, 2016
Easily Disabling PowerShell Remoting
View Disable_PSRemoting.ps1
# Remove all trusted hosts
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '*'
# Disable PSRemoting
Disable-PSRemoting -Force
# Disabling PSRemoting is not enough to reverse the changes that were done when PSRemoting was enabled.
# The PSSession Configurations created when the command Set-WSManQuickConfig was executed needs to be reverted
Unregister-PSSessionConfiguration -Name *
# Ensure that all PSRemoting configuration were removed
Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Wrap
@kdemanuele
kdemanuele / Enable_PS_Remoting_Source.ps1
Created Dec 30, 2016
Easy steps to enable Powershell Remoting
View Enable_PS_Remoting_Source.ps1
### Enable PSRemoting on Source Machine
# Enable the PSRemoting on all interfaces even the Public Network Interfaces
Enable-PSRemoting -Force -SkipNetworkProfileCheck -Verbose
# Allow only remote access from specific computers
Set-Item WSMan:\localhost\Client\TrustedHosts -Value '[List of IPs or Computer Names to where commands will be sent]'
# Restart the WinRM service
Restart-Service WinRM