sample changes

This commit is contained in:
jaszymas
2021-04-26 11:00:47 -07:00
parent 603fc59e32
commit b4a7e08d8f
2 changed files with 9 additions and 48 deletions
@@ -26,19 +26,6 @@ param location string = resourceGroup().location
@description('The current time.')
param currentTime string = utcNow('u')
////////////////////////////////////////////////////////////////////
// Assign the user to the Contributor role for the resource group //
////////////////////////////////////////////////////////////////////
resource AssignContributorToUser_Resource 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
name: guid(uniqueString(resourceGroup().id),currentTime)
scope: any(resourceGroup().id)
properties: {
roleDefinitionId: '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c'
principalId: userObjectId
principalType: 'User'
}
}
////////////////////////////////////////////
// Create and configure a database server //
////////////////////////////////////////////
@@ -154,35 +141,6 @@ resource AssignContributor_Resource 'Microsoft.Authorization/roleAssignments@202
]
}
// Create a storage account
@description('Storage Account type')
param storageAccountType string = 'Standard_LRS'
var storageAccountName_var = '${projectName}storage'
resource storageAccountResource 'Microsoft.Storage/storageAccounts@2020-08-01-preview' = {
name: storageAccountName_var
location: location
sku: {
name: storageAccountType
}
kind: 'StorageV2'
properties: {}
}
output storageoutput string = storageAccountResource.name
resource storageAccountname 'Microsoft.Storage/storageAccounts/blobServices@2020-08-01-preview' = {
name: '${storageAccountResource.name}/default'
properties: {
cors: {
corsRules: []
}
deleteRetentionPolicy: {
enabled: false
}
}
}
// Create an App Service plan in Free tier
resource WebAppServicePlan_Resource 'Microsoft.Web/serverfarms@2020-09-01' = {
name: '${projectName}plan'
@@ -230,10 +188,6 @@ resource DeployWebApp 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
kind: 'AzurePowerShell'
properties: {
azPowerShellVersion: '5.0'
storageAccountSettings: {
storageAccountName: storageAccountResource.name
storageAccountKey: listKeys(storageAccountResource.id, storageAccountResource.apiVersion).keys[0].value
}
scriptContent: '$PropertiesObject = @{repoUrl = "https://github.com/Pietervanhove/AEDemo.git"; branch = "master"; isManualIntegration = "true";} \r\n Set-AzResource -Properties $PropertiesObject -ResourceGroupName ${resourceGroup().name} -ResourceType Microsoft.Web/sites/sourcecontrols -ResourceName ${WebApp_Resource.name}/web -ApiVersion 2015-08-01 -Force'
cleanupPreference: 'OnSuccess'
retentionInterval: 'P1D'
@@ -6,7 +6,7 @@ Import-Module "SqlServer" -MinimumVersion "21.1.18235"
# Prompt the user to enter the values of deployment parameters
######################################################################
$subscriptionName = Read-Host -Prompt "Enter your subscription name"
$subscriptionId = Read-Host -Prompt "Enter your subscription id"
$projectName = Read-Host -Prompt "Enter a project name that is used to generate resource names"
$location = Read-Host -Prompt "Enter a region where you want to deploy the demo environment"
$sqlAdminUserName = Read-Host -Prompt "Enter the username of the Azure SQL database server administrator for SQL authentication"
@@ -22,7 +22,7 @@ $projectName = $projectName.ToLower()
######################################################################
Connect-AzAccount
$context = Set-AzContext -Subscription $subscriptionName
$context = Set-AzContext -Subscription $subscriptionId
$userName = $context.Account.Id
$userObjectId = $(Get-AzADUser -UserPrincipalName $userName).Id
@@ -46,6 +46,12 @@ New-AzResourceGroupDeployment `
-sqlAdminPassword $sqlAdminPassword `
-clientIP $clientIP
######################################################################
# Clean up not needed resources
######################################################################
Remove-AzDeploymentScript -ResourceGroupName $resourceGroupName -Name "${projectName}script"
######################################################################
# Populate the database with data
######################################################################
@@ -151,6 +157,7 @@ $attestationUrl = $attestationProvider.AttestUri + “/attest/SgxEnclave”
######################################################################
$app = Get-AzWebApp -Name $appName -ResourceGroupName $resourceGroupName
Write-Host -ForegroundColor "green" "Resource group name: $resourceGroupName"
Write-Host -ForegroundColor "green" "Database server name: $serverName"
Write-Host -ForegroundColor "green" "Database name: $databaseName"
Write-Host -ForegroundColor "green" "Attestation URL: $attestationUrl"