Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1562631
commit ddd5a9e
Showing
16 changed files
with
614 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## Ignore Visual Studio temporary files, build results, and | ||
## files generated by popular Visual Studio add-ons. | ||
## | ||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore | ||
|
||
# User-specific files | ||
*.rsuser | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# User-specific files (MonoDevelop/Xamarin Studio) | ||
*.userprefs | ||
|
||
# Mono auto generated files | ||
mono_crash.* | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
[Aa][Rr][Mm]/ | ||
[Aa][Rr][Mm]64/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Ll]og/ | ||
[Ll]ogs/ | ||
|
||
# Visual Studio 2015/2017 cache/options directory | ||
.vs/ | ||
# Uncomment if you have tasks that create the project's static files in wwwroot | ||
#wwwroot/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// Copyright 2016-2020, Pulumi Corporation. All rights reserved. | ||
|
||
using Pulumi; | ||
using Pulumi.AzureNextGen.Authorization.V20200401Preview; | ||
using Pulumi.AzureNextGen.Resources.Latest; | ||
using Pulumi.AzureNextGen.Storage.Latest; | ||
using Pulumi.AzureNextGen.Synapse.V20190601Preview; | ||
using Pulumi.AzureNextGen.Synapse.V20190601Preview.Inputs; | ||
using Pulumi.Random; | ||
using SkuArgs = Pulumi.AzureNextGen.Storage.Latest.Inputs.SkuArgs; | ||
|
||
class MyStack : Stack | ||
{ | ||
public MyStack() | ||
{ | ||
var config = new Pulumi.Config(); | ||
var location = config.Get("location") ?? "WestUS"; | ||
|
||
var resourceGroup = new ResourceGroup("resourceGroup", new ResourceGroupArgs | ||
{ | ||
ResourceGroupName = "synapse-rg", | ||
Location = location | ||
}); | ||
|
||
var storageAccount = new StorageAccount("storageAccount", new StorageAccountArgs | ||
{ | ||
ResourceGroupName = resourceGroup.Name, | ||
Location = resourceGroup.Location, | ||
AccountName = "synapsesa", | ||
AccessTier = "Hot", | ||
EnableHttpsTrafficOnly = true, | ||
IsHnsEnabled = true, | ||
Kind = "StorageV2", | ||
Sku = new SkuArgs | ||
{ | ||
Name = "Standard_RAGRS" | ||
}, | ||
}); | ||
var dataLakeStorageAccountUrl = Output.Format($"https://{storageAccount.Name}.dfs.core.windows.net"); | ||
|
||
var users = new BlobContainer("users", new BlobContainerArgs | ||
{ | ||
ResourceGroupName = resourceGroup.Name, | ||
AccountName = storageAccount.Name, | ||
ContainerName = "users", | ||
PublicAccess = "None" | ||
}); | ||
|
||
var workspace = new Workspace("workspace", new WorkspaceArgs | ||
{ | ||
ResourceGroupName = resourceGroup.Name, | ||
Location = resourceGroup.Location, | ||
WorkspaceName = "my-workspace", | ||
DefaultDataLakeStorage = new DataLakeStorageAccountDetailsArgs | ||
{ | ||
AccountUrl = dataLakeStorageAccountUrl, | ||
Filesystem = "users" | ||
}, | ||
Identity = new ManagedIdentityArgs | ||
{ | ||
Type = "SystemAssigned" | ||
}, | ||
SqlAdministratorLogin = "sqladminuser", | ||
SqlAdministratorLoginPassword = "YourStrongPassword" | ||
}); | ||
|
||
var allowAll = new IpFirewallRule("allowAll", new IpFirewallRuleArgs | ||
{ | ||
ResourceGroupName = resourceGroup.Name, | ||
WorkspaceName = workspace.Name, | ||
RuleName = "allowAll", | ||
EndIpAddress = "255.255.255.255", | ||
StartIpAddress = "0.0.0.0" | ||
}); | ||
|
||
var subscriptionId = resourceGroup.Id.Apply(id => id.Split('/')[2]); | ||
var roleDefinitionId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/ba92f5b4-2d11-453d-a403-e96b0029c9fe"; | ||
|
||
var storageAccess = new RoleAssignment("storageAccess", new RoleAssignmentArgs | ||
{ | ||
RoleAssignmentName = new RandomUuid("roleName").Result, | ||
Scope = storageAccount.Id, | ||
PrincipalId = workspace.Identity.Apply(identity => identity.PrincipalId).Apply(v => v ?? "<preview>"), | ||
PrincipalType = "ServicePrincipal", | ||
RoleDefinitionId = roleDefinitionId | ||
}); | ||
var userAccess = new RoleAssignment("userAccess", new RoleAssignmentArgs | ||
{ | ||
RoleAssignmentName = new RandomUuid("userRoleName").Result, | ||
Scope = storageAccount.Id, | ||
PrincipalId = config.Require("userObjectId"), | ||
PrincipalType = "User", | ||
RoleDefinitionId = roleDefinitionId | ||
}); | ||
|
||
var sqlPool = new SqlPool("sqlPool", new SqlPoolArgs | ||
{ | ||
ResourceGroupName = resourceGroup.Name, | ||
Location = resourceGroup.Location, | ||
WorkspaceName = workspace.Name, | ||
SqlPoolName = "SQLPOOL1", | ||
Collation = "SQL_Latin1_General_CP1_CI_AS", | ||
CreateMode = "Default", | ||
Sku = new Pulumi.AzureNextGen.Synapse.V20190601Preview.Inputs.SkuArgs | ||
{ | ||
Name = "DW100c" | ||
}, | ||
}); | ||
|
||
var sparkPool = new BigDataPool("sparkPool", new BigDataPoolArgs | ||
{ | ||
ResourceGroupName = resourceGroup.Name, | ||
Location = resourceGroup.Location, | ||
WorkspaceName = workspace.Name, | ||
BigDataPoolName = "Spark1", | ||
AutoPause = new AutoPausePropertiesArgs | ||
{ | ||
DelayInMinutes = 15, | ||
Enabled = true, | ||
}, | ||
AutoScale = new AutoScalePropertiesArgs | ||
{ | ||
Enabled = true, | ||
MaxNodeCount = 3, | ||
MinNodeCount = 3, | ||
}, | ||
NodeCount = 3, | ||
NodeSize = "Small", | ||
NodeSizeFamily = "MemoryOptimized", | ||
SparkVersion = "2.4" | ||
}); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright 2016-2020, Pulumi Corporation. All rights reserved. | ||
using System.Threading.Tasks; | ||
using Pulumi; | ||
|
||
class Program | ||
{ | ||
static Task<int> Main() => Deployment.RunAsync<MyStack>(); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: azure-nextgen-cs-synapse | ||
runtime: dotnet | ||
description: Creates Azure Synapse workspace with SQL and Spark pools |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[![Deploy](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new) | ||
|
||
# Azure Synapse Workspace and Pools | ||
|
||
Starting point for enterprise analytics solutions based on Azure Synapse. | ||
|
||
## Running the App | ||
|
||
1. Create a new stack: | ||
|
||
``` | ||
$ pulumi stack init dev | ||
``` | ||
|
||
1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step): | ||
|
||
``` | ||
$ az login | ||
``` | ||
|
||
1. Set the Azure region location to use: | ||
|
||
``` | ||
$ pulumi config set location westus2 | ||
``` | ||
|
||
1. Set the user ID to grant access to (e.g., your current user): | ||
|
||
``` | ||
$ pulumi config set userObjectId $(az ad signed-in-user show --query=objectId | tr -d '"') | ||
``` | ||
|
||
1. Run `pulumi up` to preview and deploy changes: | ||
|
||
```bash | ||
$ pulumi up | ||
Previewing changes: | ||
... | ||
|
||
Performing changes: | ||
... | ||
Resources: | ||
+ 13 created | ||
|
||
Duration: 10m53s | ||
``` | ||
|
||
1. Navigate to https://web.azuresynapse.net and sign in to your new workspace. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Pulumi" Version="2.*" /> | ||
<PackageReference Include="Pulumi.AzureNextGen" Version="0.*" /> | ||
<PackageReference Include="Pulumi.Random" Version="2.*" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.pyc | ||
venv/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: azure-nextgen-py-synapse | ||
runtime: python | ||
description: Creates Azure Synapse workspace with SQL and Spark pools |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[![Deploy](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new) | ||
|
||
# Azure Synapse Workspace and Pools | ||
|
||
Starting point for enterprise analytics solutions based on Azure Synapse. | ||
|
||
## Running the App | ||
|
||
1. Create a new stack: | ||
|
||
```bash | ||
$ pulumi stack init dev | ||
``` | ||
|
||
1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step): | ||
|
||
```bash | ||
$ az login | ||
``` | ||
|
||
1. Create a Python virtualenv, activate it, and install dependencies: | ||
|
||
This installs the dependent packages [needed](https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/) for our Pulumi program. | ||
|
||
```bash | ||
$ python3 -m venv venv | ||
$ source venv/bin/activate | ||
$ pip3 install -r requirements.txt | ||
``` | ||
|
||
1. Set the Azure region location to use: | ||
|
||
``` | ||
$ pulumi config set location westus2 | ||
``` | ||
|
||
1. Set the user ID to grant access to (e.g., your current user): | ||
|
||
``` | ||
$ pulumi config set userObjectId $(az ad signed-in-user show --query=objectId | tr -d '"') | ||
``` | ||
|
||
1. Run `pulumi up` to preview and deploy changes: | ||
|
||
```bash | ||
$ pulumi up | ||
Previewing changes: | ||
... | ||
|
||
Performing changes: | ||
... | ||
Resources: | ||
+ 13 created | ||
|
||
Duration: 10m53s | ||
``` | ||
|
||
1. Navigate to https://web.azuresynapse.net and sign in to your new workspace. |
Oops, something went wrong.