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
-- For more useful info on permissions, see: | |
-- https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-database-role-members-transact-sql?view=sqlallproducts-allversions | |
-- Create logins and users on Azure SQL databases. | |
-- Adjust roles and schemas appropriately | |
DECLARE @user varchar(255) = 'USERNAME'; | |
DECLARE @pass varchar(255) = 'PASSWORD'; | |
DECLARE @schema varchar(255) = '[dbo]'; | |
IF ((SELECT DB_NAME()) = 'master') |
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
Function Test-Administrator | |
{ | |
$user = [Security.Principal.WindowsIdentity]::GetCurrent(); | |
(New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) | |
} |
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
Function Decrypt-SecureString { | |
param( | |
[Parameter(ValueFromPipeline=$true,Mandatory=$true,Position=0)] | |
[System.Security.SecureString] | |
$sstr | |
) | |
$marshal = [System.Runtime.InteropServices.Marshal] | |
$ptr = $marshal::SecureStringToBSTR( $sstr ) | |
$str = $marshal::PtrToStringBSTR( $ptr ) | |
$marshal::ZeroFreeBSTR( $ptr ) |
NewerOlder