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 Using-Object( | |
[System.IDisposable] | |
$InputObject, | |
[scriptblock] | |
$ScriptBlock = {throw "ScriptBlock is mandatory, please provide a value."}) | |
{ | |
try | |
{ | |
. $ScriptBlock |
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
#This function generate auth token using azure sdk | |
Function GetAuthTokenUsingAzureSdk { | |
Param ( | |
[Parameter(Mandatory)][ValidateNotNull()][ValidateNotNullOrEmpty()] | |
[String]$apiEndpointUri, | |
[Parameter(Mandatory)][ValidateNotNull()][ValidateNotNullOrEmpty()] | |
[String]$tenantId, | |
[Parameter(Mandatory)][ValidateNotNull()][ValidateNotNullOrEmpty()] | |
[String]$applicationId, | |
[Parameter(Mandatory)][ValidateNotNull()][ValidateNotNullOrEmpty()] |
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
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"variables": { | |
"storageAccountApiVersion": "2018-07-01", | |
"storageAccountNameTidy": "[toLower(trim(parameters('storageAccountName')))]", | |
"blobEndPoint":"[concat('https://',variables('storageAccountNameTidy'),'.blob.core.windows.net/')]" | |
}, | |
"parameters": { | |
"location": { |
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
"resources": [ | |
{ | |
"name": "[parameters('storageAccountName')]", | |
"type": "Microsoft.Storage/storageAccounts", | |
"apiVersion": "[variables('storageAccountApiVersion')]", | |
"location": "[parameters('location')]", | |
"properties": { | |
"accessTier": "[parameters('accessTier')]", | |
"supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]" | |
}, |
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
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"functions": [ | |
{ | |
"namespace": "rt", | |
"members": { | |
"containerNameWithLocation": { | |
"parameters": [ | |
{ |
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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<ItemGroup> | |
<CloudArtifacts Include=".Cloud\Data\**\*.*"/> | |
</ItemGroup> | |
<Target Name="CopyFiles"> | |
<Copy SourceFiles="@(CloudArtifacts)" DestinationFiles="@(CloudArtifacts->'c:\PackableFiles\%(RecursiveDir)%(Filename)%(Extension)')" /> | |
</Target> |
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
#Create AD app | |
$dummyUrl = "https://dummy.dummy.com" | |
$passpowrd = "Qwerty@123!" | |
$securePassword = ConvertTo-SecureString -String $passpowrd -AsPlainText -Force | |
$app = New-AzureRmADApplication -DisplayName $dummyUrl ` | |
-IdentifierUris $dummyUrl ` | |
-HomePage $dummyUrl ` | |
-Password $securePassword -Verbose |
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
#Login with service principal | |
$clientId = "<CLIENT ID>" | |
$credentials = New-Object System.Management.Automation.PSCredential ($clientId, $securePassword) | |
Login-AzureRmAccount -ServicePrincipal -TenantId "<TENANTID>" ` | |
-SubscriptionId "<SUBSCRIPTIONID>" ` | |
-Credential $credentials |
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
#Create Service principal | |
New-AzureRmADServicePrincipal -ApplicationId $app.ApplicationId ` | |
-DisplayName $dummyUrl ` | |
-Password $securePassword ` | |
-Scope "/subscriptions/<SUBSCRIPTION ID>" ` | |
-Role Contributor ` | |
-StartDate ([datetime]::Now) ` | |
-EndDate $([datetime]::now.AddYears(1)) -Verbose |
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
#Create AD app | |
$dummyUrl = "https://dummy.dummy.com" | |
$passpowrd = "Qwerty@123!" | |
$securePassword = ConvertTo-SecureString -String $passpowrd -AsPlainText -Force | |
$app = New-AzureRmADApplication -DisplayName $dummyUrl ` | |
-IdentifierUris $dummyUrl ` | |
-HomePage $dummyUrl ` | |
-Password $securePassword -Verbose |