Skip to content

Instantly share code, notes, and snippets.

View peteraritchie's full-sized avatar
😖

Peter Ritchie peteraritchie

😖
View GitHub Profile
# Create Storage Sync Service with File Share and Sync Group
## See also: https://learn.microsoft.com/en-us/azure/storage/file-sync/file-sync-deployment-guide?tabs=azure-powershell%2Cproactive-portal#deploy-the-storage-sync-service
$resourceGroupName = 'learn-file-sync-rg'
$location = 'EastUS'
$date = (Get-Date).ToString("yyyy-MM-dd")
$tags = @{'createdDate'=$date; 'intention'='learn'}
## Create Storage Account
$storageAccountName = 'extendcadfiles'+(Get-Random -Maximum 9999).ToString().PadLeft(4,'0')
# Create a Windows file server
## Create a resource group
$resourceGroup = 'learn-file-sync-rg'
$location = 'EastUS'
New-AzResourceGroup -Name $resourceGroup -Location $location
## Create a subnet
$subnetConfig = New-AzVirtualNetworkSubnetConfig `
-Name Syncpublicnet `
@startuml
skinparam componentStyle rectangle
component "VPN Gateway" as VPNGateway
component "Virtual Network" as VNet
/'
VNet --* "0..1" VPNGateway
'/
VNet --o "0..1" VPNGateway
# the following is from https://web.archive.org/web/20131105093357/http://blogs.msdn.com:80/b/virtual_pc_guy/archive/2010/09/23/a-self-elevating-powershell-script.aspx
if((new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator))
{
# We are running "as Administrator" - so change the title and background color to indicate this
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
$Host.UI.RawUI.BackgroundColor = "DarkBlue"
clear-host
}
else
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{

C# errors and warnings without docs as of 2022-09-03

Parsed from the Roslyn source code using Roslyn by GenerateCSharpErrors

Code Severity Message
CS0181 Error Attribute constructor parameter '{0}' has type '{1}', which is not a valid attribute parameter type
CS0190 Error The __arglist construct is valid only within a variable argument method
CS0224 Error A method with vararg cannot be generic, be in a generic type, or have a params parameter
CS0257 Error An __arglist parameter must be the last parameter in a formal parameter list

Azure VM Sizing Heuristics

Here are some guidelines based on the scenario you are targeting.

What are you doing? Consider these sizes
General use computing / web Testing and development, small to medium databases, or low to medium traffic web servers B, Dsv3, Dv3, DSv2, Dv2
Heavy computational tasks Medium traffic web servers, network appliances, batch processes, and application servers Fsv2, Fs, F
Large memory usage Relational database servers, medium to large caches, and in-memory analytics. Esv3, Ev3, M, GS, G, DSv2, Dv2
Data storage and processing Big Data, SQL, and NoSQL databases, which need high disk throughput and IO Ls
{"schemaVersion": 1, "label": "coverage", "message": "100%", "color": "green"}
{"schemaVersion": 1, "label": "coverage", "message": "100%", "color": "green"}