diff --git a/classic-azure-cs-botservice/Azure.BotService.csproj b/classic-azure-cs-botservice/Azure.BotService.csproj
index 2390bd595..e1fff993a 100644
--- a/classic-azure-cs-botservice/Azure.BotService.csproj
+++ b/classic-azure-cs-botservice/Azure.BotService.csproj
@@ -14,8 +14,8 @@
-
-
+
+
diff --git a/classic-azure-cs-botservice/BotStack.cs b/classic-azure-cs-botservice/BotStack.cs
index 1cd7e0e5f..8a8db0857 100644
--- a/classic-azure-cs-botservice/BotStack.cs
+++ b/classic-azure-cs-botservice/BotStack.cs
@@ -7,6 +7,7 @@
using Pulumi.Azure.Bot;
using Pulumi.Azure.Core;
using Pulumi.AzureAD;
+using Pulumi.AzureAD.Inputs;
using Pulumi.Random;
using Cognitive = Pulumi.Azure.Cognitive;
using Storage = Pulumi.Azure.Storage;
@@ -27,15 +28,11 @@ public BotStack()
AccountTier = "Standard"
});
- var appServicePlan = new Plan("asp", new PlanArgs
+ var appServicePlan = new ServicePlan("asp", new ServicePlanArgs
{
ResourceGroupName = resourceGroup.Name,
- Kind = "App",
- Sku = new PlanSkuArgs
- {
- Tier = "Basic",
- Size = "B1"
- }
+ OsType = "Linux",
+ SkuName = "B1",
});
var container = new Storage.Container("zips", new Storage.ContainerArgs
@@ -75,57 +72,52 @@ public BotStack()
var msa = new Application("msapp", new ApplicationArgs
{
- Oauth2AllowImplicitFlow = false,
- AvailableToOtherTenants = true,
- PublicClient = true,
+ PublicClient = new ApplicationPublicClientArgs
+ {
+ RedirectUris =
+ {
+ "https://address1.com",
+ },
+ },
+ FallbackPublicClientEnabled = true,
DisplayName = "msapp"
});
- var pwd = new RandomPassword("password", new RandomPasswordArgs
- {
- Length = 16,
- MinNumeric = 1,
- MinSpecial = 1,
- MinUpper = 1,
- MinLower = 1
- });
-
- var msaSecret = new ApplicationPassword("msasecret", new ApplicationPasswordArgs
+ var msaSecret = new ApplicationPassword("msasecret", new Pulumi.AzureAD.ApplicationPasswordArgs
{
- ApplicationObjectId = msa.ObjectId,
- EndDateRelative = "8640h",
- Value = pwd.Result
+ ApplicationId = msa.Id,
});
- var app = new AppService("app", new AppServiceArgs
+ var app = new LinuxWebApp("app", new LinuxWebAppArgs
{
ResourceGroupName = resourceGroup.Name,
- AppServicePlanId = appServicePlan.Id,
+ ServicePlanId = appServicePlan.Id,
AppSettings =
{
{"WEBSITE_RUN_FROM_PACKAGE", codeBlobUrl},
- {"MicrosoftAppId", msa.ApplicationId},
+ {"MicrosoftAppId", msa.Id},
{"MicrosoftAppPassword", msaSecret.Value},
{"LuisApiKey", luis.PrimaryAccessKey},
},
- HttpsOnly = true
+ HttpsOnly = true,
+ SiteConfig = new LinuxWebAppSiteConfigArgs { },
});
var bot = new WebApp(botName, new WebAppArgs
{
DisplayName = botName,
- MicrosoftAppId = msa.ApplicationId,
+ MicrosoftAppId = msa.Id,
ResourceGroupName = resourceGroup.Name,
Sku = "F0",
Location = "global",
- Endpoint = Output.Format($"https://{app.DefaultSiteHostname}/api/messages"),
+ Endpoint = Output.Format($"https://{app.DefaultHostname}/api/messages"),
DeveloperAppInsightsApiKey = appInsightApiKey.Key,
DeveloperAppInsightsApplicationId = appInsights.AppId,
DeveloperAppInsightsKey = appInsights.InstrumentationKey
});
this.BotEndpoint = bot.Endpoint;
- this.MicrosoftAppId = msa.ApplicationId;
+ this.MicrosoftAppId = msa.Id;
this.MicrosoftAppPassword = msaSecret.Value;
}
diff --git a/classic-azure-cs-botservice/Pulumi.yaml b/classic-azure-cs-botservice/Pulumi.yaml
index d0baae8d5..6856701a8 100644
--- a/classic-azure-cs-botservice/Pulumi.yaml
+++ b/classic-azure-cs-botservice/Pulumi.yaml
@@ -6,5 +6,7 @@ template:
azure:location:
description: Azure DC region
default: North Europe
+ azure:subscriptionId:
+ description: The Azure Subscription to deploy into
botName:
description: Microsoft Azure Bot Name
\ No newline at end of file
diff --git a/classic-azure-cs-botservice/README.md b/classic-azure-cs-botservice/README.md
index 690ea1e5c..e4144f86c 100644
--- a/classic-azure-cs-botservice/README.md
+++ b/classic-azure-cs-botservice/README.md
@@ -21,41 +21,42 @@ To deploy your infrastructure, follow the below steps.
### Publish Bot Steps
-1. Within the **/bot** subfolder, publish the bot to subfolder called publish:
+1. Within the **/bot** subfolder, publish the bot to subfolder called publish:
```bash
- $ dotnet publish -o publish
+ dotnet publish -o publish
```
### Pulumi Steps
-1. Within the **azure-cs-botservice** folder, create a new stack:
+1. Within the **azure-cs-botservice** folder, create a new stack:
```bash
- $ pulumi stack init dev
+ pulumi stack init dev
```
-2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
+1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
```bash
- $ az login
+ az login
```
-3. Configure the location to deploy the resources to:
+1. Configure the location to deploy the resources to:
```bash
- $ pulumi config set azure:location "North Europe"
+ pulumi config set azure:location "North Europe"
+ pulumi config set azure:subscriptionId
```
-4. Configure the Bot Name:
+1. Configure the Bot Name:
```bash
- $ pulumi config set botName PulumiBot1
+ pulumi config set botName PulumiBot1
```
-5. Run `pulumi up` to preview and deploy changes:
+1. Run `pulumi up` to preview and deploy changes:
- ```bash
+ ```console
$ pulumi up
Previewing changes:
...
@@ -67,20 +68,20 @@ To deploy your infrastructure, follow the below steps.
Update duration: 1m22s
```
-6. Check the deployed bot using either:
+1. Check the deployed bot using either:
- * Azure Portal Azure Bot Service - [Test in Webchat feature](https://docs.microsoft.com/en-us/azure/bot-service/abs-quickstart?view=azure-bot-service-4.0#test-the-bot)
- * [Bot Framework Emulator](https://github.com/Microsoft/BotFramework-Emulator) pointing to the output bot endpoint and Microsoft Application Id and the secret you supplied:
+ * Azure Portal Azure Bot Service - [Test in Webchat feature](https://docs.microsoft.com/en-us/azure/bot-service/abs-quickstart?view=azure-bot-service-4.0#test-the-bot)
+ * [Bot Framework Emulator](https://github.com/Microsoft/BotFramework-Emulator) pointing to the output bot endpoint and Microsoft Application Id and the secret you supplied:
- ```bash
- $ BotEndpoint: "https://app8asdf.azurewebsites.net/api/messages"
- $ MicrosoftAppId: "b5e65403-923c-4568-z2f6-a6f41b258azz"
- $ MicrosoftAppPassword: ""
- ```
+ ```yaml
+ BotEndpoint: "https://app8asdf.azurewebsites.net/api/messages"
+ MicrosoftAppId: "b5e65403-923c-4568-z2f6-a6f41b258azz"
+ MicrosoftAppPassword: ""
+ ```
-7. Once you've finished, you can tear down your stack's resources by destroying and removing it:
+1. Once you've finished, you can tear down your stack's resources by destroying and removing it:
```bash
- $ pulumi destroy -y
- $ pulumi stack rm -y
+ pulumi destroy -y
+ pulumi stack rm -y
```
diff --git a/classic-azure-cs-cosmosapp-component/.gitignore b/classic-azure-cs-cosmosapp-component/.gitignore
deleted file mode 100644
index e64527066..000000000
--- a/classic-azure-cs-cosmosapp-component/.gitignore
+++ /dev/null
@@ -1,353 +0,0 @@
-## 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/
-
-# Visual Studio 2017 auto generated files
-Generated\ Files/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-# NUnit
-*.VisualState.xml
-TestResult.xml
-nunit-*.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-# Benchmark Results
-BenchmarkDotNet.Artifacts/
-
-# .NET Core
-project.lock.json
-project.fragment.lock.json
-artifacts/
-
-# StyleCop
-StyleCopReport.xml
-
-# Files built by Visual Studio
-*_i.c
-*_p.c
-*_h.h
-*.ilk
-*.meta
-*.obj
-*.iobj
-*.pch
-*.pdb
-*.ipdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*_wpftmp.csproj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opendb
-*.opensdf
-*.sdf
-*.cachefile
-*.VC.db
-*.VC.VC.opendb
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-*.sap
-
-# Visual Studio Trace Files
-*.e2e
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding add-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# AxoCover is a Code Coverage Tool
-.axoCover/*
-!.axoCover/settings.json
-
-# Visual Studio code coverage results
-*.coverage
-*.coveragexml
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-nCrunchTemp_*
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# Note: Comment the next line if you want to checkin your web deploy settings,
-# but database connection strings (with potential passwords) will be unencrypted
-*.pubxml
-*.publishproj
-
-# Microsoft Azure Web App publish settings. Comment the next line if you want to
-# checkin your Azure Web App publish settings, but sensitive information contained
-# in these scripts will be unencrypted
-PublishScripts/
-
-# NuGet Packages
-*.nupkg
-# NuGet Symbol Packages
-*.snupkg
-# The packages folder can be ignored because of Package Restore
-**/[Pp]ackages/*
-# except build/, which is used as an MSBuild target.
-!**/[Pp]ackages/build/
-# Uncomment if necessary however generally it will be regenerated when needed
-#!**/[Pp]ackages/repositories.config
-# NuGet v3's project.json files produces more ignorable files
-*.nuget.props
-*.nuget.targets
-
-# Microsoft Azure Build Output
-csx/
-*.build.csdef
-
-# Microsoft Azure Emulator
-ecf/
-rcf/
-
-# Windows Store app package directories and files
-AppPackages/
-BundleArtifacts/
-Package.StoreAssociation.xml
-_pkginfo.txt
-*.appx
-*.appxbundle
-*.appxupload
-
-# Visual Studio cache files
-# files ending in .cache can be ignored
-*.[Cc]ache
-# but keep track of directories ending in .cache
-!?*.[Cc]ache/
-
-# Others
-ClientBin/
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.jfm
-*.pfx
-*.publishsettings
-orleans.codegen.cs
-
-# Including strong name files can present a security risk
-# (https://github.com/github/gitignore/pull/2483#issue-259490424)
-#*.snk
-
-# Since there are multiple workflows, uncomment next line to ignore bower_components
-# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
-#bower_components/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-ServiceFabricBackup/
-*.rptproj.bak
-
-# SQL Server files
-*.mdf
-*.ldf
-*.ndf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-*.rptproj.rsuser
-*- [Bb]ackup.rdl
-*- [Bb]ackup ([0-9]).rdl
-*- [Bb]ackup ([0-9][0-9]).rdl
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# GhostDoc plugin setting file
-*.GhostDoc.xml
-
-# Node.js Tools for Visual Studio
-.ntvs_analysis.dat
-node_modules/
-
-# Visual Studio 6 build log
-*.plg
-
-# Visual Studio 6 workspace options file
-*.opt
-
-# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
-*.vbw
-
-# Visual Studio LightSwitch build output
-**/*.HTMLClient/GeneratedArtifacts
-**/*.DesktopClient/GeneratedArtifacts
-**/*.DesktopClient/ModelManifest.xml
-**/*.Server/GeneratedArtifacts
-**/*.Server/ModelManifest.xml
-_Pvt_Extensions
-
-# Paket dependency manager
-.paket/paket.exe
-paket-files/
-
-# FAKE - F# Make
-.fake/
-
-# CodeRush personal settings
-.cr/personal
-
-# Python Tools for Visual Studio (PTVS)
-__pycache__/
-*.pyc
-
-# Cake - Uncomment if you are using it
-# tools/**
-# !tools/packages.config
-
-# Tabs Studio
-*.tss
-
-# Telerik's JustMock configuration file
-*.jmconfig
-
-# BizTalk build output
-*.btp.cs
-*.btm.cs
-*.odx.cs
-*.xsd.cs
-
-# OpenCover UI analysis results
-OpenCover/
-
-# Azure Stream Analytics local run output
-ASALocalRun/
-
-# MSBuild Binary and Structured Log
-*.binlog
-
-# NVidia Nsight GPU debugger configuration file
-*.nvuser
-
-# MFractors (Xamarin productivity tool) working folder
-.mfractor/
-
-# Local History for Visual Studio
-.localhistory/
-
-# BeatPulse healthcheck temp database
-healthchecksdb
-
-# Backup folder for Package Reference Convert tool in Visual Studio 2017
-MigrationBackup/
-
-# Ionide (cross platform F# VS Code tools) working folder
-.ionide/
diff --git a/classic-azure-cs-cosmosapp-component/ArchiveFunctionApp.cs b/classic-azure-cs-cosmosapp-component/ArchiveFunctionApp.cs
deleted file mode 100644
index cc6a31722..000000000
--- a/classic-azure-cs-cosmosapp-component/ArchiveFunctionApp.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
-
-using System.Collections.Generic;
-
-using Pulumi;
-using Pulumi.Azure.AppService;
-using Pulumi.Azure.AppService.Inputs;
-using Pulumi.Azure.Storage;
-
-public class ArchiveFunctionApp : ComponentResource
-{
- public Output AppId { get; private set; } = null!;
-
- public ArchiveFunctionApp(string name, ArchiveFunctionAppArgs args, ComponentResourceOptions? options = null)
- : base("examples:azure:ArchiveFunctionApp", name, options)
- {
- var opts = new CustomResourceOptions { Parent = this };
-
- var storageAccount = new Account($"sa{args.Location}", new AccountArgs
- {
- ResourceGroupName = args.ResourceGroupName,
- Location = args.Location,
- AccountReplicationType = "LRS",
- AccountTier = "Standard",
- }, opts);
-
- var appServicePlan = new Plan($"asp-{args.Location}", new PlanArgs
- {
- ResourceGroupName = args.ResourceGroupName,
- Location = args.Location,
- Kind = "FunctionApp",
- Sku = new PlanSkuArgs
- {
- Tier = "Dynamic",
- Size = "Y1",
- },
- }, opts);
-
- var container = new Container($"zips-{args.Location}", new ContainerArgs
- {
- StorageAccountName = storageAccount.Name,
- ContainerAccessType = "private",
- }, opts);
-
- var blob = new Blob($"zip-{args.Location}", new BlobArgs
- {
- StorageAccountName = storageAccount.Name,
- StorageContainerName = container.Name,
- Type = "Block",
- Source = args.Archive,
- }, opts);
-
- var codeBlobUrl = SharedAccessSignature.SignedBlobReadUrl(blob, storageAccount);
-
- args.AppSettings.Add("runtime", "dotnet");
- args.AppSettings.Add("WEBSITE_RUN_FROM_PACKAGE", codeBlobUrl);
-
- var app = new FunctionApp($"app-{args.Location}", new FunctionAppArgs
- {
- ResourceGroupName = args.ResourceGroupName,
- Location = args.Location,
- AppServicePlanId = appServicePlan.Id,
- AppSettings = args.AppSettings,
- StorageConnectionString = storageAccount.PrimaryConnectionString,
- Version = "~2",
- }, opts);
-
- this.AppId = app.Id;
- }
-}
-
-public class ArchiveFunctionAppArgs
-{
- public Input ResourceGroupName { get; set; } = null!;
- public string Location { get; set; } = null!;
- public Input Archive { get; set; } = null!;
-
- private InputMap? _appSettings;
- public InputMap AppSettings
- {
- get => _appSettings ?? (_appSettings = new InputMap());
- set => _appSettings = value;
- }
-}
diff --git a/classic-azure-cs-cosmosapp-component/Azure.CosmosAppComponent.csproj b/classic-azure-cs-cosmosapp-component/Azure.CosmosAppComponent.csproj
deleted file mode 100644
index d5c143cfb..000000000
--- a/classic-azure-cs-cosmosapp-component/Azure.CosmosAppComponent.csproj
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- Exe
- net6.0
- enable
-
-
-
-
-
-
-
-
-
- $(DefaultItemExcludes);app\**\*
-
-
-
diff --git a/classic-azure-cs-cosmosapp-component/Containers.cs b/classic-azure-cs-cosmosapp-component/Containers.cs
deleted file mode 100644
index 4fd414d64..000000000
--- a/classic-azure-cs-cosmosapp-component/Containers.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2016-2020, Pulumi Corporation. All rights reserved.
-
-using Pulumi;
-using Pulumi.Azure.ContainerService;
-using Pulumi.Azure.ContainerService.Inputs;
-using Pulumi.Azure.Core;
-using Pulumi.Docker;
-
-public static class Containers
-{
- public static Output Run()
- {
- // Read a list of target locations from the config file:
- // Expecting a comma-separated list, e.g., "westus,eastus,westeurope"
- var locations = new Pulumi.Config().Require("locations").Split(",");
-
- var resourceGroup = new ResourceGroup("cosmosaci-rg", new ResourceGroupArgs {Location = locations[0]});
-
- var app = new CosmosApp("aci", new CosmosAppArgs
- {
- ResourceGroup = resourceGroup,
- Locations = locations,
- DatabaseName = "pricedb",
- ContainerName = "prices",
- Factory = global =>
- {
- var registry = new Registry("global", new RegistryArgs
- {
- ResourceGroupName = resourceGroup.Name,
- AdminEnabled = true,
- Sku = "Premium",
- }, global.Options);
-
- var dockerImage = new Image("node-app", new ImageArgs
- {
- ImageName = Output.Format($"{registry.LoginServer}/mynodeapp:v1.0.0"),
- Build = "./container",
- Registry = new ImageRegistry
- {
- Server = registry.LoginServer,
- Username = registry.AdminUsername,
- Password = registry.AdminPassword,
- },
- }, new ComponentResourceOptions {Parent = registry});
-
- return region =>
- {
- var connectionString = global.CosmosAccount.ConnectionStrings.Apply(cs => cs[0]);
- var group = new Group($"aci-{region.Location}", new GroupArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = region.Location,
- ImageRegistryCredentials =
- {
- new GroupImageRegistryCredentialArgs
- {
- Server = registry.LoginServer,
- Username = registry.AdminUsername,
- Password = registry.AdminPassword,
- }
- },
- OsType = "Linux",
- Containers =
- {
- new GroupContainerArgs
- {
- Cpu = 0.5,
- Image = dockerImage.ImageName,
- Memory = 1.5,
- Name = "hello-world",
- Ports =
- {
- new GroupContainerPortArgs
- {
- Port = 80,
- Protocol = "TCP",
- }
- },
- EnvironmentVariables =
- {
- {"ENDPOINT", global.CosmosAccount.Endpoint},
- {"MASTER_KEY", global.CosmosAccount.PrimaryMasterKey},
- {"DATABASE", global.Database.Name},
- {"COLLECTION", global.Container.Name},
- {"LOCATION", region.Location},
- },
- },
- },
- IpAddressType = "public",
- DnsNameLabel = $"acishop-{region.Location}",
- }, global.Options);
-
- return new ExternalEndpoint(group.Fqdn);
- };
- }
- });
-
- return Output.Format($"{app.Endpoint}/cosmos");
- }
-}
diff --git a/classic-azure-cs-cosmosapp-component/CosmosApp.cs b/classic-azure-cs-cosmosapp-component/CosmosApp.cs
deleted file mode 100644
index 47b449f39..000000000
--- a/classic-azure-cs-cosmosapp-component/CosmosApp.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
-
-using System;
-using System.Collections.Immutable;
-using System.Linq;
-
-using Pulumi;
-using Pulumi.Azure.Core;
-using Pulumi.Azure.CosmosDB;
-using Pulumi.Azure.CosmosDB.Inputs;
-using Pulumi.Azure.Network;
-using Pulumi.Azure.Network.Inputs;
-
-public class GlobalContext
-{
- public ResourceGroup ResourceGroup { get; }
- public Account CosmosAccount { get; }
- public SqlDatabase Database { get; }
- public SqlContainer Container { get; }
- public CustomResourceOptions Options { get; }
-
- internal GlobalContext(ResourceGroup resourceGroup, Account cosmosAccount, SqlDatabase database, SqlContainer container, CustomResourceOptions options)
- {
- this.ResourceGroup = resourceGroup;
- this.CosmosAccount = cosmosAccount;
- this.Database = database;
- this.Container = container;
- this.Options = options;
- }
-}
-
-public class RegionalContext
-{
- public string Location { get; }
-
- internal RegionalContext(string location)
- {
- this.Location = location;
- }
-}
-
-public interface IRegionalEndpoint
-{
- // Type of the endpoint
- Input Type { get; }
- // Azure resource ID (App Service and Public IP are supported)
- Input? Id { get; }
- // An arbitrary URL for other resource types
- Input? Url { get; }
-}
-
-public class AzureEndpoint : IRegionalEndpoint
-{
- public Input Type => "azureEndpoints";
-
- public Input Id { get; }
-
- public Input? Url => null;
-
- public AzureEndpoint(Input id)
- {
- this.Id = id;
- }
-}
-
-public class ExternalEndpoint : IRegionalEndpoint
-{
- public Input Type => "externalEndpoints";
-
- public Input? Id => null;
-
- public Input Url { get; }
-
- public ExternalEndpoint(Input url)
- {
- this.Url = url;
- }
-}
-
-public class CosmosAppArgs
-{
- public ResourceGroup ResourceGroup { get; set; } = null!;
- public string[] Locations { get; set; } = null!;
- public Func> Factory { get; set; } = null!;
- public Input DatabaseName { get; set; } = null!;
- public Input ContainerName { get; set; } = null!;
- public Input? EnableMultiMaster { get; set; }
-}
-
-public class CosmosApp : ComponentResource
-{
- public Output Endpoint { get; private set; } = null!;
-
- public CosmosApp(string name, CosmosAppArgs args, ComponentResourceOptions? options = null)
- : base("examples:azure:CosmosApp", name, options)
- {
- var resourceGroup = args.ResourceGroup;
- var locations = args.Locations;
- var primaryLocation = locations[0];
- var parentOptions = new CustomResourceOptions { Parent = this };
-
- // Cosmos DB Account with multiple replicas
- var cosmosAccount = new Account($"cosmos-{name}",
- new AccountArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = primaryLocation,
- GeoLocations = locations.Select((l, i) => new AccountGeoLocationArgs { Location = l, FailoverPriority = i }).ToArray(),
- OfferType = "Standard",
- ConsistencyPolicy = new AccountConsistencyPolicyArgs { ConsistencyLevel = "Session" },
- EnableMultipleWriteLocations = args.EnableMultiMaster,
- },
- parentOptions);
-
- var database = new SqlDatabase($"db-{name}",
- new SqlDatabaseArgs
- {
- ResourceGroupName = resourceGroup.Name,
- AccountName = cosmosAccount.Name,
- Name = args.DatabaseName,
- },
- parentOptions);
-
- var container = new SqlContainer($"sql-{name}",
- new SqlContainerArgs
- {
- ResourceGroupName = resourceGroup.Name,
- AccountName = cosmosAccount.Name,
- DatabaseName = database.Name,
- Name = args.ContainerName,
- },
- parentOptions);
-
- // Traffic Manager as a global HTTP endpoint
- var profile = new TrafficManagerProfile($"tm{name}",
- new TrafficManagerProfileArgs
- {
- ResourceGroupName = resourceGroup.Name,
- TrafficRoutingMethod = "Performance",
- DnsConfig = new TrafficManagerProfileDnsConfigArgs
- {
- // Subdomain must be globally unique, so we default it with the full resource group name
- RelativeName = Output.Format($"{name}{resourceGroup.Name}"),
- Ttl = 60,
- },
- MonitorConfig = new TrafficManagerProfileMonitorConfigArgs
- {
- Protocol = "HTTP",
- Port = 80,
- Path = "/api/ping",
- }
- },
- parentOptions);
-
- var globalContext = new GlobalContext(resourceGroup, cosmosAccount, database, container, parentOptions);
- var buildLocation = args.Factory(globalContext);
- var endpointOptions = new CustomResourceOptions { Parent = profile, DeleteBeforeReplace = true };
-
- var endpoints = locations.Select(location =>
- {
- var app = buildLocation(new RegionalContext(location));
-
- return new TrafficManagerEndpoint($"tm{name}{location}".Truncate(16),
- new TrafficManagerEndpointArgs
- {
- ResourceGroupName = resourceGroup.Name,
- ProfileName = profile.Name,
- Type = app.Type,
- TargetResourceId = app.Id,
- Target = app.Url,
- EndpointLocation = location,
- },
- endpointOptions);
- }).ToList();
-
- this.Endpoint = Output.Format($"http://{profile.Fqdn}");
- this.RegisterOutputs();
- }
-}
diff --git a/classic-azure-cs-cosmosapp-component/DemoStack.cs b/classic-azure-cs-cosmosapp-component/DemoStack.cs
deleted file mode 100644
index 87af3bfad..000000000
--- a/classic-azure-cs-cosmosapp-component/DemoStack.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016-2020, Pulumi Corporation. All rights reserved.
-
-using Pulumi;
-
-class DemoStack : Stack
-{
- public DemoStack()
- {
- this.FunctionsEndpoint = Functions.Run();
- this.ContainersEndpoint = Containers.Run();
- this.VmssEndpoint = VmScaleSets.Run();
- }
-
- [Output] public Output FunctionsEndpoint { get; set; }
-
- [Output] public Output ContainersEndpoint { get; set; }
-
- [Output] public Output VmssEndpoint { get; set; }
-}
diff --git a/classic-azure-cs-cosmosapp-component/Extensions.cs b/classic-azure-cs-cosmosapp-component/Extensions.cs
deleted file mode 100644
index 1b05271aa..000000000
--- a/classic-azure-cs-cosmosapp-component/Extensions.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-public static class Extensions
-{
- public static string Truncate(this string value, int maxLength)
- {
- if (string.IsNullOrEmpty(value)) return value;
- return value.Length <= maxLength ? value : value.Substring(0, maxLength);
- }
-}
\ No newline at end of file
diff --git a/classic-azure-cs-cosmosapp-component/Functions.cs b/classic-azure-cs-cosmosapp-component/Functions.cs
deleted file mode 100644
index 8da521ec4..000000000
--- a/classic-azure-cs-cosmosapp-component/Functions.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2016-2020, Pulumi Corporation. All rights reserved.
-
-using Pulumi;
-using Pulumi.Azure.Core;
-
-public static class Functions
-{
- public static Output Run()
- {
- // Read a list of target locations from the config file:
- // Expecting a comma-separated list, e.g., "westus,eastus,westeurope"
- var locations = new Config().Require("locations").Split(",");
-
- var resourceGroup = new ResourceGroup("cosmosfunctions-rg", new ResourceGroupArgs {Location = locations[0]});
-
- var app = new CosmosApp("functions", new CosmosAppArgs
- {
- ResourceGroup = resourceGroup,
- Locations = locations,
- DatabaseName = "pricedb",
- ContainerName = "prices",
- Factory = global => region =>
- {
- var connectionString = global.CosmosAccount.ConnectionStrings.Apply(cs => cs[0]);
- var func = new ArchiveFunctionApp($"afa-{region.Location}", new ArchiveFunctionAppArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = region.Location,
- Archive = new FileArchive("./app/bin/Debug/net6.0/publish"),
- AppSettings =
- {
- {"CosmosDBConnection", connectionString},
- },
- },
- new ComponentResourceOptions {Parent = global.Options.Parent});
-
- return new AzureEndpoint(func.AppId);
- },
- });
-
- return Output.Format($"{app.Endpoint}/cosmos");
- }
-}
diff --git a/classic-azure-cs-cosmosapp-component/Program.cs b/classic-azure-cs-cosmosapp-component/Program.cs
deleted file mode 100644
index ce24073e1..000000000
--- a/classic-azure-cs-cosmosapp-component/Program.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2016-2020, Pulumi Corporation. All rights reserved.
-
-using System.Threading.Tasks;
-using Pulumi;
-
-class Program
-{
- static Task Main() => Deployment.RunAsync();
-}
diff --git a/classic-azure-cs-cosmosapp-component/Pulumi.yaml b/classic-azure-cs-cosmosapp-component/Pulumi.yaml
deleted file mode 100644
index 1df1ff69b..000000000
--- a/classic-azure-cs-cosmosapp-component/Pulumi.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-name: azure-cs-cosmosapp-component
-description: Reusable Component to Create Globally-distributed Applications with Azure Cosmos DB
-runtime: dotnet
-template:
- config:
- locations:
- description: Comma-separated list of Azure regions
- default: westus,westeurope
diff --git a/classic-azure-cs-cosmosapp-component/README.md b/classic-azure-cs-cosmosapp-component/README.md
deleted file mode 100644
index e97f09a5e..000000000
--- a/classic-azure-cs-cosmosapp-component/README.md
+++ /dev/null
@@ -1,96 +0,0 @@
-[![Deploy this example with Pulumi](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new?template=https://github.com/pulumi/examples/blob/master/classic-azure-cs-cosmosapp-component/README.md#gh-light-mode-only)
-[![Deploy this example with Pulumi](https://get.pulumi.com/new/button-light.svg)](https://app.pulumi.com/new?template=https://github.com/pulumi/examples/blob/master/classic-azure-cs-cosmosapp-component/README.md#gh-dark-mode-only)
-
-# Reusable Component to Create Globally-distributed Applications with Azure Cosmos DB
-
-This example demonstrates the usage of Pulumi to create globally-distributed applications with Azure Cosmos DB as the backend and pluggable infrastrustructure as the web tier.
-
-The application shows several notable features:
-
-1. Easy global deployments - a config setting provides a list of all the regions to deploy and a single execution deploys across them all.
-2. Abstraction - the `CosmosApp` component - abstracts away all the common logic for a global app with Cosmos DB multi-region data distribution and Traffic Manager for routing the traffic.
-3. Multi-model - an implementation example is currently provided for serverless functions and virtual machines.
-
-## `CosmosApp` component
-
-The [`CosmosApp`](CosmosApp.cs) defines a skeleton for the application. While not limiting the type of compute resources, it creates the multi-regional pieces of the infrastructure:
-
-![Cosmos App](https://github.com/mikhailshilkov/pulumi-cosmos/raw/master/pictures/globalapp.png)
-
-## Deploying the App
-
-To deploy your infrastructure, follow the below steps.
-
-### Prerequisites
-
-1. [Install Pulumi](https://www.pulumi.com/docs/get-started/install/)
-2. [Install .NET Core 3.0+](https://dotnet.microsoft.com/download)
-
-### Steps
-
-#### Step 1: Create a new stack
-
-```
-$ pulumi stack init dev
-```
-
-#### Step 2: Log in to the Azure CLI
-
-You will be prompted to do this during deployment if you forget this step.
-
-```
-$ az login
-```
-
-#### Step 3: Build and publish the Azure Functions project:
-
- ```
- $ dotnet publish app
- ```
-
-#### Step 4: Configure the list of regions to deploy to
-
-```
-$ pulumi config set azure:location westus
-$ pulumi config set locations westus,westeurope
-```
-
-#### Step 5: Deploy your changes
-
-Run `pulumi up` to preview and deploy changes:
-
-```
-$ pulumi up
-Previewing changes:
-+ azure-cs-cosmosapp-component-dev create
-+ examples:azure:CosmosApp vms create
-+ azure:network:VirtualNetwork vnet-westeurope create
-+ azure:network:PublicIp pip-westeurope create
-+ azure:trafficmanager:Profile tmvms create
-+ azure:trafficmanager:Endpoint tmvmswesteurope create
-+ azure:cosmosdb:Account cosmos-vms
-...
-```
-
-### Step 6: Check the deployed website endpoints
-
-Three endpoints are now available. For example,
-
-```
-$ pulumi stack output VmssEndpoint
-http://vmssrgcc15ea50.trafficmanager.net/cosmos
-
-$ curl "$(pulumi stack output VmssEndpoint)"
-Document 'cosmos' not found
-```
-
-Go to the Azure portal and add a document with the ID "cosmos" to receive a non-empty response.
-
-### Step 7: Clean up
-
-Once you've finished experimenting, tear down your stack's resources by destroying and removing it:
-
-```bash
-$ pulumi destroy --yes
-$ pulumi stack rm --yes
-```
diff --git a/classic-azure-cs-cosmosapp-component/VmScaleSets.cs b/classic-azure-cs-cosmosapp-component/VmScaleSets.cs
deleted file mode 100644
index fb4759d19..000000000
--- a/classic-azure-cs-cosmosapp-component/VmScaleSets.cs
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright 2016-2020, Pulumi Corporation. All rights reserved.
-
-using System;
-using System.IO;
-using Pulumi;
-using Pulumi.Azure.Compute;
-using Pulumi.Azure.Compute.Inputs;
-using Pulumi.Azure.Core;
-using Pulumi.Azure.Lb;
-using Pulumi.Azure.Lb.Inputs;
-using Pulumi.Azure.Monitoring;
-using Pulumi.Azure.Monitoring.Inputs;
-using Pulumi.Azure.Network;
-
-public static class VmScaleSets
-{
- public static Output Run()
- {
- // Read a list of target locations from the config file:
- // Expecting a comma-separated list, e.g., "westus,eastus,westeurope"
- var locations = new Config().Require("locations").Split(",");
-
- var resourceGroup = new ResourceGroup("cosmosvms-rg", new ResourceGroupArgs {Location = locations[0]});
-
- var vmss = new CosmosApp("vmss", new CosmosAppArgs
- {
- ResourceGroup = resourceGroup,
- Locations = locations,
- DatabaseName = "pricedb",
- ContainerName = "prices",
- Factory = new Builder(resourceGroup).BuildVMScaleSetApp,
- });
-
- return Output.Format($"{vmss.Endpoint}/cosmos");
- }
-
- private class Builder
- {
- private ResourceGroup resourceGroup;
-
- public Builder(ResourceGroup resourceGroup)
- {
- this.resourceGroup = resourceGroup;
- }
-
- public Func BuildVMScaleSetApp(GlobalContext context)
- {
- var options =
- CustomResourceOptions.Merge(context.Options, new CustomResourceOptions {DeleteBeforeReplace = true});
- var file = File.ReadAllText("./vm/vmCustomData.yaml");
- return (RegionalContext region) =>
- {
- var location = region.Location;
- var domainName = $"rnddnplm{location}"; //TODO: random
-
- var publicIp = new PublicIp($"pip-{location}", new PublicIpArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = location,
- AllocationMethod = "Static",
- DomainNameLabel = domainName,
- },
- options);
-
- var loadBalancer = new LoadBalancer($"lb-{location}", new LoadBalancerArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = location,
- FrontendIpConfigurations =
- {
- new LoadBalancerFrontendIpConfigurationArgs
- {
- Name = "PublicIPAddress",
- PublicIpAddressId = publicIp.Id,
- }
- }
- },
- options);
-
- var bpepool = new BackendAddressPool($"bap-{location}", new BackendAddressPoolArgs
- {
- ResourceGroupName = resourceGroup.Name,
- LoadbalancerId = loadBalancer.Id,
- },
- options);
-
- var probe = new Probe($"ssh-probe-{location}".Truncate(16), new ProbeArgs
- {
- ResourceGroupName = resourceGroup.Name,
- LoadbalancerId = loadBalancer.Id,
- Port = 80,
- },
- options);
-
- var rule = new Rule($"rule-{location}", new RuleArgs
- {
- ResourceGroupName = resourceGroup.Name,
- BackendAddressPoolId = bpepool.Id,
- BackendPort = 80,
- FrontendIpConfigurationName = "PublicIPAddress",
- FrontendPort = 80,
- LoadbalancerId = loadBalancer.Id,
- ProbeId = probe.Id,
- Protocol = "Tcp",
- },
- options);
-
- var vnet = new VirtualNetwork($"vnet-{location}", new VirtualNetworkArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = location,
- AddressSpaces = {"10.0.0.0/16"},
- },
- options);
-
- var subnet = new Subnet($"subnet-{location}", new SubnetArgs
- {
- ResourceGroupName = resourceGroup.Name,
- AddressPrefix = "10.0.2.0/24",
- VirtualNetworkName = vnet.Name,
- },
- options);
-
- var customData = Output.All(context.CosmosAccount.Endpoint,
- context.CosmosAccount.PrimaryMasterKey, context.Database.Name, context.Container.Name)
- .Apply(values =>
- {
- return file.Replace("${ENDPOINT}", values[0])
- .Replace("${MASTER_KEY}", values[1])
- .Replace("${DATABASE}", values[2])
- .Replace("${COLLECTION}", values[3])
- .Replace("${LOCATION}", location);
- });
-
- var scaleSet = new ScaleSet($"vmss-{location}", new ScaleSetArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = location,
- NetworkProfiles =
- {
- new ScaleSetNetworkProfileArgs
- {
- IpConfigurations =
- {
- new ScaleSetNetworkProfileIpConfigurationArgs
- {
- LoadBalancerBackendAddressPoolIds = {bpepool.Id},
- Name = "IPConfiguration",
- Primary = true,
- SubnetId = subnet.Id,
- }
- },
- Name = "networkprofile",
- Primary = true,
- }
- },
- OsProfile = new ScaleSetOsProfileArgs
- {
- AdminUsername = "neo",
- AdminPassword = "SEcurePwd$3",
- ComputerNamePrefix = "lab",
- CustomData = customData,
- },
- OsProfileLinuxConfig = new ScaleSetOsProfileLinuxConfigArgs
- {DisablePasswordAuthentication = false},
- Sku = new ScaleSetSkuArgs
- {
- Capacity = 1,
- Name = "Standard_DS1_v2",
- Tier = "Standard",
- },
- StorageProfileDataDisks =
- {
- new ScaleSetStorageProfileDataDiskArgs
- {
- Caching = "ReadWrite",
- CreateOption = "Empty",
- DiskSizeGb = 10,
- Lun = 0,
- }
- },
- StorageProfileImageReference = new ScaleSetStorageProfileImageReferenceArgs
- {
- Offer = "UbuntuServer",
- Publisher = "Canonical",
- Sku = "18.04-LTS",
- Version = "latest",
- },
- StorageProfileOsDisk = new ScaleSetStorageProfileOsDiskArgs
- {
- Caching = "ReadWrite",
- CreateOption = "FromImage",
- ManagedDiskType = "Standard_LRS",
- Name = "",
- },
- UpgradePolicyMode = "Automatic",
- },
- CustomResourceOptions.Merge(options, new CustomResourceOptions {DependsOn = {bpepool, rule}}));
-
- var autoscale = new AutoscaleSetting($"as-{location}", new AutoscaleSettingArgs
- {
- ResourceGroupName = resourceGroup.Name,
- Location = location,
- Notification = new AutoscaleSettingNotificationArgs
- {
- Email = new AutoscaleSettingNotificationEmailArgs
- {
- CustomEmails = {"admin@contoso.com"},
- SendToSubscriptionAdministrator = true,
- SendToSubscriptionCoAdministrator = true,
- },
- },
- Profiles =
- {
- new AutoscaleSettingProfileArgs
- {
- Capacity = new AutoscaleSettingProfileCapacityArgs
- {
- Default = 1,
- Maximum = 10,
- Minimum = 1,
- },
- Name = "defaultProfile",
- Rules =
- {
- new AutoscaleSettingProfileRuleArgs
- {
- MetricTrigger = new AutoscaleSettingProfileRuleMetricTriggerArgs
- {
- MetricName = "Percentage CPU",
- MetricResourceId = scaleSet.Id,
- Operator = "GreaterThan",
- Statistic = "Average",
- Threshold = 75,
- TimeAggregation = "Average",
- TimeGrain = "PT1M",
- TimeWindow = "PT5M",
- },
- ScaleAction = new AutoscaleSettingProfileRuleScaleActionArgs
- {
- Cooldown = "PT1M",
- Direction = "Increase",
- Type = "ChangeCount",
- Value = 1,
- },
- },
- new AutoscaleSettingProfileRuleArgs
- {
- MetricTrigger = new AutoscaleSettingProfileRuleMetricTriggerArgs
- {
- MetricName = "Percentage CPU",
- MetricResourceId = scaleSet.Id,
- Operator = "LessThan",
- Statistic = "Average",
- Threshold = 25,
- TimeAggregation = "Average",
- TimeGrain = "PT1M",
- TimeWindow = "PT5M",
- },
- ScaleAction = new AutoscaleSettingProfileRuleScaleActionArgs
- {
- Cooldown = "PT1M",
- Direction = "Decrease",
- Type = "ChangeCount",
- Value = 1,
- },
- },
- }
- }
- },
- TargetResourceId = scaleSet.Id,
- },
- options);
-
- return new AzureEndpoint(publicIp.Id);
- };
- }
- }
-}
diff --git a/classic-azure-cs-cosmosapp-component/app/Functions.csproj b/classic-azure-cs-cosmosapp-component/app/Functions.csproj
deleted file mode 100644
index b3bb6b921..000000000
--- a/classic-azure-cs-cosmosapp-component/app/Functions.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- net6.0
- v3
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
- PreserveNewest
- Never
-
-
-
-
diff --git a/classic-azure-cs-cosmosapp-component/app/Hello.cs b/classic-azure-cs-cosmosapp-component/app/Hello.cs
deleted file mode 100644
index 37969fb08..000000000
--- a/classic-azure-cs-cosmosapp-component/app/Hello.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Azure.WebJobs;
-using Microsoft.Azure.WebJobs.Extensions.Http;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Newtonsoft.Json;
-
-namespace Functions
-{
- public static class MyFunctions
- {
- [FunctionName("Hello")]
- public static async Task Hello(
- [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
- ILogger log)
- {
- log.LogInformation("C# HTTP trigger function processed a request.");
-
- string name = req.Query["name"];
-
- string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
- dynamic data = JsonConvert.DeserializeObject(requestBody);
- name = name ?? data?.name;
-
- return name != null
- ? (ActionResult)new OkObjectResult($"Hello, {name}")
- : new BadRequestObjectResult("Please pass a name on the query string or in the request body");
- }
-
- [FunctionName("Cosmos")]
- public static IActionResult Cosmos(
- [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "cosmos")] HttpRequest req,
- [CosmosDB(databaseName: "pricedb",
- collectionName: "prices",
- ConnectionStringSetting = "CosmosDBConnection",
- Id = "test")] ToDoItem toDoItem,
- ILogger log)
- {
- log.LogInformation("C# HTTP trigger function processed a request.");
-
- if (toDoItem == null)
- {
- return new OkObjectResult("Please create a document with id=test");
- }
- else
- {
- return new OkObjectResult(toDoItem);
- }
- }
-
- public class ToDoItem
- {
- public string Id { get; set; }
- public string Name { get; set; }
- }
- }
-}
diff --git a/classic-azure-cs-cosmosapp-component/app/host.json b/classic-azure-cs-cosmosapp-component/app/host.json
deleted file mode 100644
index dc0bbb4da..000000000
--- a/classic-azure-cs-cosmosapp-component/app/host.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "version": "2.0",
- "extensions": {
- "http": {
- "routePrefix": ""
- }
- }
-}
\ No newline at end of file
diff --git a/classic-azure-cs-cosmosapp-component/app/local.settings.json b/classic-azure-cs-cosmosapp-component/app/local.settings.json
deleted file mode 100644
index 4fce9ff39..000000000
--- a/classic-azure-cs-cosmosapp-component/app/local.settings.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "IsEncrypted": false,
- "Values": {
- "AzureWebJobsStorage": "UseDevelopmentStorage=true",
- "FUNCTIONS_WORKER_RUNTIME": "dotnet"
- }
-}
\ No newline at end of file
diff --git a/classic-azure-cs-cosmosapp-component/container/.dockerignore b/classic-azure-cs-cosmosapp-component/container/.dockerignore
deleted file mode 100644
index 93f136199..000000000
--- a/classic-azure-cs-cosmosapp-component/container/.dockerignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules
-npm-debug.log
diff --git a/classic-azure-cs-cosmosapp-component/container/Dockerfile b/classic-azure-cs-cosmosapp-component/container/Dockerfile
deleted file mode 100644
index 53bbea666..000000000
--- a/classic-azure-cs-cosmosapp-component/container/Dockerfile
+++ /dev/null
@@ -1,6 +0,0 @@
-FROM node:8.9.3-alpine
-RUN mkdir -p /usr/src/app
-COPY ./app/* /usr/src/app/
-WORKDIR /usr/src/app
-RUN npm install
-CMD node /usr/src/app/index.js
diff --git a/classic-azure-cs-cosmosapp-component/container/app/index.html b/classic-azure-cs-cosmosapp-component/container/app/index.html
deleted file mode 100644
index d0327a673..000000000
--- a/classic-azure-cs-cosmosapp-component/container/app/index.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- YEAH Welcome to Azure Container Instances!
-
-
-
-
-
-
-
Welcome to Azure Container Instances!
-
-
-
-
-
-
diff --git a/classic-azure-cs-cosmosapp-component/container/app/index.js b/classic-azure-cs-cosmosapp-component/container/app/index.js
deleted file mode 100644
index 974313416..000000000
--- a/classic-azure-cs-cosmosapp-component/container/app/index.js
+++ /dev/null
@@ -1,37 +0,0 @@
-const express = require('express');
-const morgan = require('morgan');
-const cosmos = require('@azure/cosmos');
-
-const app = express();
-app.use(morgan('combined'));
-
-
-app.get('/', (req, res) => {
- res.sendFile(__dirname + '/index.html')
-});
-
-app.get('/cosmos', async (req, res) => {
- const endpoint = process.env.ENDPOINT;
- const key = process.env.MASTER_KEY;
- const database = process.env.DATABASE;
- const collection = process.env.COLLECTION;
- const location = process.env.LOCATION;
-
- const client = new cosmos.CosmosClient({ endpoint, key, connectionPolicy: { preferredLocations: [location] } });
- const container = client.database(database).container(collection);
- const response = await container.item("test", undefined).read();
-
- if (response.resource && response.resource.url) {
- res.send(response.resource.url);
- } else {
- res.status(404).end();
- }
-});
-
-app.get('/api/ping', (req, res) => {
- res.send('Ack')
-});
-
-var listener = app.listen(process.env.PORT || 80, function() {
- console.log('listening on port ' + listener.address().port);
-});
diff --git a/classic-azure-cs-cosmosapp-component/container/app/package.json b/classic-azure-cs-cosmosapp-component/container/app/package.json
deleted file mode 100644
index 98393f65a..000000000
--- a/classic-azure-cs-cosmosapp-component/container/app/package.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "aci-helloworld",
- "version": "1.0.0",
- "description": "",
- "main": "index.js",
- "dependencies": {
- "@azure/cosmos": "^3.1.1",
- "express": "^4.14.0",
- "morgan": "^1.8.2"
- },
- "devDependencies": {},
- "author": ""
-}
diff --git a/classic-azure-cs-cosmosapp-component/vm/vmCustomData.yaml b/classic-azure-cs-cosmosapp-component/vm/vmCustomData.yaml
deleted file mode 100644
index 9ec4b1df0..000000000
--- a/classic-azure-cs-cosmosapp-component/vm/vmCustomData.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
-#cloud-config
-package_upgrade: true
-packages:
- - nginx
- - nodejs
- - npm
-write_files:
- - owner: www-data:www-data
- - path: /etc/nginx/sites-available/default
- content: |
- server {
- listen 80;
- location / {
- proxy_pass http://localhost:3000;
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection keep-alive;
- proxy_set_header Host $host;
- proxy_cache_bypass $http_upgrade;
- }
- }
- - owner: azureuser:azureuser
- - path: /home/azureuser/myapp/index.js
- content: |
- var express = require('express')
- var app = express()
- var os = require('os');
- const cosmos = require('@azure/cosmos');
- const endpoint = process.env.ENDPOINT;
- const key = process.env.MASTER_KEY;
- const database = process.env.DATABASE;
- const collection = process.env.COLLECTION;
- const preferredLocations = [process.env.LOCATION];
- const connectionPolicy = { preferredLocations };
- const client = new cosmos.CosmosClient({ endpoint, key, connectionPolicy });
- app.get('/', function (req, res) {
- res.send('Hello World1 from host ' + os.hostname() + '!')
- })
- app.get('/node', function (req, res) {
- const version = require('child_process').execSync('nodejs --version');
- res.send(version.toString());
- })
- app.get('/cosmos', (req, res) => {
- client
- .database(database)
- .container(collection)
- .item('test', undefined)
- .read()
- .then(r => res.send(r.resource))
- .catch(err => res.status(500).send(err));
- })
- app.get('/api/ping', (req, res) => {
- res.send('Ack')
- })
- app.listen(3000, function () {
- console.log('Hello world app listening on port 3000!')
- })
-runcmd:
- - export ENDPOINT="${ENDPOINT}"
- - export MASTER_KEY="${MASTER_KEY}"
- - export DATABASE="${DATABASE}"
- - export COLLECTION="${COLLECTION}"
- - export LOCATION="${LOCATION}"
- - service nginx restart
- - cd "/home/azureuser/myapp"
- - npm init
- - npm install express -y
- - npm install @azure/cosmos -y
- - nodejs index.js
\ No newline at end of file
diff --git a/classic-azure-cs-msi-keyvault-rbac/AppStack.cs b/classic-azure-cs-msi-keyvault-rbac/AppStack.cs
index fe947cbd2..4f86991ae 100644
--- a/classic-azure-cs-msi-keyvault-rbac/AppStack.cs
+++ b/classic-azure-cs-msi-keyvault-rbac/AppStack.cs
@@ -8,7 +8,7 @@
using Pulumi.Azure.Core;
using Pulumi.Azure.KeyVault;
using Pulumi.Azure.KeyVault.Inputs;
-using Pulumi.Azure.Sql;
+using Pulumi.Azure.MSSql;
using Pulumi.Azure.Storage;
using Pulumi.Random;
@@ -35,8 +35,8 @@ public AppStack()
// Azure SQL Server that we want to access from the application
var administratorLoginPassword = new RandomPassword("password",
- new RandomPasswordArgs {Length = 16, Special = true}).Result;
- var sqlServer = new SqlServer("sqlserver", new SqlServerArgs
+ new RandomPasswordArgs { Length = 16, Special = true }).Result;
+ var sqlServer = new Server("sqlserver", new ServerArgs
{
ResourceGroupName = resourceGroup.Name,
// The login and password are required but won't be used in our application
@@ -48,9 +48,8 @@ public AppStack()
// Azure SQL Database that we want to access from the application
var database = new Database("db", new DatabaseArgs
{
- ResourceGroupName = resourceGroup.Name,
- ServerName = sqlServer.Name,
- RequestedServiceObjectiveName = "S0",
+ ServerId = sqlServer.Id,
+ SkuName = "S0",
});
// The connection string that has no credentials in it: authertication will come through MSI
@@ -67,15 +66,11 @@ public AppStack()
});
// A plan to host the App Service
- var appServicePlan = new Plan("asp", new PlanArgs
+ var appServicePlan = new ServicePlan("asp", new ServicePlanArgs
{
ResourceGroupName = resourceGroup.Name,
- Kind = "App",
- Sku = new PlanSkuArgs
- {
- Tier = "Basic",
- Size = "B1",
- },
+ OsType = "Linux",
+ SkuName = "B1",
});
// ASP.NET deployment package
@@ -105,7 +100,7 @@ public AppStack()
// The current principal has to be granted permissions to Key Vault so that it can actually add and then remove
// secrets to/from the Key Vault. Otherwise, 'pulumi up' and 'pulumi destroy' operations will fail.
ObjectId = currentPrincipal,
- SecretPermissions = {"delete", "get", "list", "set"},
+ SecretPermissions = {"Delete", "Get", "List", "Set"},
}
},
});
@@ -120,13 +115,13 @@ public AppStack()
// The application hosted in App Service
- var app = new AppService("app", new AppServiceArgs
+ var app = new LinuxWebApp("app", new LinuxWebAppArgs
{
ResourceGroupName = resourceGroup.Name,
- AppServicePlanId = appServicePlan.Id,
+ ServicePlanId = appServicePlan.Id,
// A system-assigned managed service identity to be used for authentication and authorization to the SQL Database and the Blob Storage
- Identity = new AppServiceIdentityArgs {Type = "SystemAssigned"},
-
+ Identity = new LinuxWebAppIdentityArgs { Type = "SystemAssigned" },
+ SiteConfig = new LinuxWebAppSiteConfigArgs { },
AppSettings =
{
// Website is deployed from a URL read from the Key Vault
@@ -137,7 +132,7 @@ public AppStack()
},
ConnectionStrings =
{
- new AppServiceConnectionStringArgs
+ new LinuxWebAppConnectionStringArgs
{
Name = "db",
Type = "SQLAzure",
@@ -155,17 +150,7 @@ public AppStack()
KeyVaultId = vault.Id,
TenantId = tenantId,
ObjectId = principalId,
- SecretPermissions = {"get"},
- });
-
- // Make the App Service the admin of the SQL Server (double check if you want a more fine-grained security model in your real app)
- var sqlAdmin = new ActiveDirectoryAdministrator("adadmin", new ActiveDirectoryAdministratorArgs
- {
- ResourceGroupName = resourceGroup.Name,
- TenantId = tenantId,
- ObjectId = principalId,
- Login = "adadmin",
- ServerName = sqlServer.Name,
+ SecretPermissions = { "Get" },
});
// Grant access from App Service to the container in the storage
@@ -181,14 +166,13 @@ public AppStack()
ips => ips.Split(",").Select(
ip => new FirewallRule($"FR{ip}", new FirewallRuleArgs
{
- ResourceGroupName = resourceGroup.Name,
+ ServerId = sqlServer.Id,
StartIpAddress = ip,
EndIpAddress = ip,
- ServerName = sqlServer.Name,
})
).ToList());
- this.Endpoint = Output.Format($"https://{app.DefaultSiteHostname}");
+ this.Endpoint = Output.Format($"https://{app.DefaultHostname}");
}
[Output] public Output Endpoint { get; set; }
diff --git a/classic-azure-cs-msi-keyvault-rbac/Azure.KeyVault.csproj b/classic-azure-cs-msi-keyvault-rbac/Azure.KeyVault.csproj
index dd4fd08d2..0362745af 100644
--- a/classic-azure-cs-msi-keyvault-rbac/Azure.KeyVault.csproj
+++ b/classic-azure-cs-msi-keyvault-rbac/Azure.KeyVault.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/classic-azure-cs-msi-keyvault-rbac/README.md b/classic-azure-cs-msi-keyvault-rbac/README.md
index 3af7b0c05..b5ff692f0 100644
--- a/classic-azure-cs-msi-keyvault-rbac/README.md
+++ b/classic-azure-cs-msi-keyvault-rbac/README.md
@@ -26,33 +26,34 @@ To deploy your infrastructure, follow the below steps.
### Steps
-1. Create a new stack:
+1. Create a new stack:
- ```
- $ pulumi stack init dev
+ ```bash
+ pulumi stack init dev
```
-1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
+1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
- ```
- $ az login
+ ```bash
+ az login
```
-1. Build and publish the ASP.NET Core project:
+1. Build and publish the ASP.NET Core project:
- ```
- $ dotnet publish webapp
+ ```bash
+ dotnet publish webapp
```
1. Set an appropriate Azure location like:
- ```
- $ pulumi config set azure:location westus
+ ```bash
+ pulumi config set azure:location westus
+ pulumi config set azure:subscriptionId
```
-1. Run `pulumi up` to preview and deploy changes:
+1. Run `pulumi up` to preview and deploy changes:
- ```
+ ```console
$ pulumi up
Previewing changes:
...
@@ -64,9 +65,9 @@ To deploy your infrastructure, follow the below steps.
Update duration: 4m16s
```
-1. Check the deployed website endpoint:
+1. Check the deployed website endpoint:
- ```
+ ```console
$ pulumi stack output Endpoint
https://app129968b8.azurewebsites.net/
$ curl "$(pulumi stack output Endpoint)"
@@ -78,6 +79,6 @@ To deploy your infrastructure, follow the below steps.
1. Once you've finished experimenting, tear down your stack's resources by destroying and removing it:
```bash
- $ pulumi destroy --yes
- $ pulumi stack rm --yes
+ pulumi destroy --yes
+ pulumi stack rm --yes
```
diff --git a/classic-azure-cs-vm-scaleset/Azure.VmScaleset.csproj b/classic-azure-cs-vm-scaleset/Azure.VmScaleset.csproj
index f444aa02a..9a4d596f6 100644
--- a/classic-azure-cs-vm-scaleset/Azure.VmScaleset.csproj
+++ b/classic-azure-cs-vm-scaleset/Azure.VmScaleset.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/classic-azure-cs-vm-scaleset/README.md b/classic-azure-cs-vm-scaleset/README.md
index bcf6fe165..f4596b906 100644
--- a/classic-azure-cs-vm-scaleset/README.md
+++ b/classic-azure-cs-vm-scaleset/README.md
@@ -17,23 +17,22 @@ To deploy your infrastructure, follow the below steps.
### Steps
-1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
+1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
- ```
- $ az login
+ ```bash
+ az login
```
1. Set an appropriate Azure location like:
- ```
- $ pulumi config set azure:location westus
+ ```bash
+ pulumi config set azure:location westus
+ pulumi config set azure:subscriptionId
```
-1. Run `pulumi up` to preview and deploy the changes:
+1. Run `pulumi up` to preview and deploy changes:
-1. Run `pulumi up` to preview and deploy changes:
-
- ```
+ ```console
$ pulumi up
Previewing changes:
...
@@ -46,16 +45,16 @@ To deploy your infrastructure, follow the below steps.
1. Get the IP address of the newly-created instance from the stack's outputs:
- ```
+ ```console
$ pulumi stack output IpAddress
137.117.15.111
```
1. Check to see that your server is now running:
- ```
+ ```console
$ curl http://$(pulumi stack output IpAddress)
- Hello, World By !
+ Hello, World By !
```
1. From there, feel free to experiment. Simply making edits and running `pulumi up` will incrementally update your stack.
@@ -63,6 +62,6 @@ To deploy your infrastructure, follow the below steps.
1. Once you've finished experimenting, tear down your stack's resources by destroying and removing it:
```bash
- $ pulumi destroy --yes
- $ pulumi stack rm --yes
+ pulumi destroy --yes
+ pulumi stack rm --yes
```
diff --git a/classic-azure-cs-vm-scaleset/VmScalesetStack.cs b/classic-azure-cs-vm-scaleset/VmScalesetStack.cs
index 76d79478a..ce06aed1d 100644
--- a/classic-azure-cs-vm-scaleset/VmScalesetStack.cs
+++ b/classic-azure-cs-vm-scaleset/VmScalesetStack.cs
@@ -28,7 +28,7 @@ public VmScalesetStack()
}
);
- var subnet = new Subnet("subnet",
+ var subnet = new Subnet("subnet",
new SubnetArgs
{
ResourceGroupName = resourceGroup.Name,
@@ -61,14 +61,12 @@ public VmScalesetStack()
var bpePool = new BackendAddressPool("bpepool",
new BackendAddressPoolArgs
{
- ResourceGroupName = resourceGroup.Name,
LoadbalancerId = lb.Id,
});
var sshProbe = new Probe("ssh-probe",
new ProbeArgs
{
- ResourceGroupName = resourceGroup.Name,
LoadbalancerId = lb.Id,
Port = applicationPort,
});
@@ -76,8 +74,7 @@ public VmScalesetStack()
var natRule = new Rule("lbnatrule-http",
new RuleArgs
{
- ResourceGroupName = resourceGroup.Name,
- BackendAddressPoolId = bpePool.Id,
+ BackendAddressPoolIds = { bpePool.Id },
BackendPort = applicationPort,
FrontendIpConfigurationName = "PublicIPAddress",
FrontendPort = applicationPort,
@@ -86,69 +83,65 @@ public VmScalesetStack()
Protocol = "Tcp",
});
- var scaleSet = new ScaleSet("vmscaleset",
- new ScaleSetArgs
+ var scaleSet = new LinuxVirtualMachineScaleSet("vmscaleset",
+ new LinuxVirtualMachineScaleSetArgs
{
ResourceGroupName = resourceGroup.Name,
- NetworkProfiles = new ScaleSetNetworkProfileArgs
+ NetworkInterfaces = new[]
{
- IpConfigurations = new ScaleSetNetworkProfileIpConfigurationArgs[] {
- new ScaleSetNetworkProfileIpConfigurationArgs {
- LoadBalancerBackendAddressPoolIds = bpePool.Id,
- Name = "IPConfiguration",
- Primary = true,
- SubnetId = subnet.Id,
- }
+ new LinuxVirtualMachineScaleSetNetworkInterfaceArgs
+ {
+ IpConfigurations = new [] {
+ new LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs {
+ LoadBalancerBackendAddressPoolIds = {bpePool.Id},
+ Name = "IPConfiguration",
+ Primary = true,
+ SubnetId = subnet.Id,
+ }
+ },
+ Name = "networkprofile",
+ Primary = true
},
- Name = "networkprofile",
- Primary = true
},
- OsProfile = new ScaleSetOsProfileArgs
- {
- ComputerNamePrefix = "vmlab",
- AdminUsername = "testadmin",
- AdminPassword = "Password1234!",
- CustomData =
- @"#!/bin/bash
+ AdminUsername = "testadmin",
+ AdminPassword = "Password1234!",
+ ComputerNamePrefix = "vmlab",
+ CustomData = System.Convert.ToBase64String(
+ System.Text.Encoding.UTF8.GetBytes(@"#!/bin/bash
echo ""Hello, World by $HOSTNAME!"" > index.html
-nohup python -m SimpleHTTPServer 80 &"
- },
- OsProfileLinuxConfig = new ScaleSetOsProfileLinuxConfigArgs
- {
- DisablePasswordAuthentication = false
- },
- Sku = new ScaleSetSkuArgs
- {
- Capacity = 1,
- Name = "Standard_DS1_v2",
- Tier = "Standard",
- },
- StorageProfileOsDisk = new ScaleSetStorageProfileOsDiskArgs
+nohup python -m SimpleHTTPServer 80 &")),
+ DisablePasswordAuthentication = false,
+ Sku = "Standard_DS1_V2",
+ OsDisk = new LinuxVirtualMachineScaleSetOsDiskArgs
{
Caching = "ReadWrite",
- CreateOption = "FromImage",
- ManagedDiskType = "Standard_LRS",
- Name = ""
+ StorageAccountType = "Standard_LRS",
},
- StorageProfileDataDisks = new ScaleSetStorageProfileDataDiskArgs
+ DataDisks = new[]
{
- Caching = "ReadWrite",
- CreateOption = "Empty",
- DiskSizeGb = 10,
- Lun = 0
+ new LinuxVirtualMachineScaleSetDataDiskArgs
+ {
+ StorageAccountType = "Standard_LRS",
+ Caching = "ReadWrite",
+ CreateOption = "Empty",
+ DiskSizeGb = 10,
+ Lun = 0
+ },
},
- StorageProfileImageReference = new ScaleSetStorageProfileImageReferenceArgs
+ SourceImageReference = new LinuxVirtualMachineScaleSetSourceImageReferenceArgs
{
Offer = "UbuntuServer",
Publisher = "Canonical",
Sku = "16.04-LTS",
Version = "latest",
},
- UpgradePolicyMode = "Manual"
-
+ AutomaticOsUpgradePolicy = new LinuxVirtualMachineScaleSetAutomaticOsUpgradePolicyArgs
+ {
+ DisableAutomaticRollback = false,
+ EnableAutomaticOsUpgrade = false,
+ },
}, new CustomResourceOptions { DeleteBeforeReplace = true, DependsOn = bpePool });
-
var autoscale = new AutoscaleSetting("vmss-autoscale",
new AutoscaleSettingArgs
{
@@ -220,8 +213,8 @@ nohup python -m SimpleHTTPServer 80 &"
},
TargetResourceId = scaleSet.Id
});
-
-
+
+
// The public IP address is not allocated until the VM is running, so wait for that
// resource to create, and then lookup the IP address again to report its public IP.
@@ -231,7 +224,7 @@ nohup python -m SimpleHTTPServer 80 &"
{
(_, string name, string resourceGroupName) = t;
var ip = await GetPublicIP.InvokeAsync(new GetPublicIPArgs
- {Name = name, ResourceGroupName = resourceGroupName});
+ { Name = name, ResourceGroupName = resourceGroupName });
return ip.IpAddress;
});
}
diff --git a/classic-azure-cs-webserver/Azure.WebServer.csproj b/classic-azure-cs-webserver/Azure.WebServer.csproj
index f444aa02a..9a4d596f6 100644
--- a/classic-azure-cs-webserver/Azure.WebServer.csproj
+++ b/classic-azure-cs-webserver/Azure.WebServer.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/classic-azure-cs-webserver/README.md b/classic-azure-cs-webserver/README.md
index 292e09c64..0b045379b 100644
--- a/classic-azure-cs-webserver/README.md
+++ b/classic-azure-cs-webserver/README.md
@@ -16,23 +16,24 @@ To deploy your infrastructure, follow the below steps.
### Steps
-1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
+1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
- ```
- $ az login
+ ```bash
+ az login
```
1. Set an appropriate Azure location like:
- ```
- $ pulumi config set azure:location westus
+ ```bash
+ pulumi config set azure:location westus
+ pulumi config set azure:subscriptionId
```
1. Run `pulumi up` to preview and deploy the changes:
-1. Run `pulumi up` to preview and deploy changes:
+1. Run `pulumi up` to preview and deploy changes:
- ```
+ ```console
$ pulumi up
Previewing changes:
...
@@ -45,14 +46,14 @@ To deploy your infrastructure, follow the below steps.
1. Get the IP address of the newly-created instance from the stack's outputs:
- ```
+ ```console
$ pulumi stack output IpAddress
137.117.15.111
```
1. Check to see that your server is now running:
- ```
+ ```console
$ curl http://$(pulumi stack output IpAddress)
Hello, World!
```
@@ -62,6 +63,6 @@ To deploy your infrastructure, follow the below steps.
1. Once you've finished experimenting, tear down your stack's resources by destroying and removing it:
```bash
- $ pulumi destroy --yes
- $ pulumi stack rm --yes
+ pulumi destroy --yes
+ pulumi stack rm --yes
```
diff --git a/classic-azure-cs-webserver/WebServerStack.cs b/classic-azure-cs-webserver/WebServerStack.cs
index 13a24632d..582137ef5 100644
--- a/classic-azure-cs-webserver/WebServerStack.cs
+++ b/classic-azure-cs-webserver/WebServerStack.cs
@@ -17,10 +17,10 @@ public WebServerStack()
new VirtualNetworkArgs
{
ResourceGroupName = resourceGroup.Name,
- AddressSpaces = {"10.0.0.0/16"},
+ AddressSpaces = { "10.0.0.0/16" },
Subnets =
{
- new VirtualNetworkSubnetArgs {Name = "default", AddressPrefix = "10.0.1.0/24"}
+ new VirtualNetworkSubnetArgs {Name = "default", AddressPrefixes = {"10.0.1.0/24"}}
}
}
);
@@ -29,7 +29,8 @@ public WebServerStack()
new PublicIpArgs
{
ResourceGroupName = resourceGroup.Name,
- AllocationMethod = "Dynamic"
+ AllocationMethod = "Dynamic",
+ Sku = "Basic",
});
var networkInterface = new NetworkInterface("server-nic",
@@ -52,7 +53,7 @@ public WebServerStack()
new VirtualMachineArgs
{
ResourceGroupName = resourceGroup.Name,
- NetworkInterfaceIds = {networkInterface.Id},
+ NetworkInterfaceIds = { networkInterface.Id },
VmSize = "Standard_A0",
DeleteDataDisksOnTermination = true,
DeleteOsDiskOnTermination = true,
@@ -82,7 +83,7 @@ nohup python -m SimpleHTTPServer 80 &"
Sku = "16.04-LTS",
Version = "latest"
}
- }, new CustomResourceOptions {DeleteBeforeReplace = true});
+ }, new CustomResourceOptions { DeleteBeforeReplace = true });
// The public IP address is not allocated until the VM is running, so wait for that
@@ -93,7 +94,7 @@ nohup python -m SimpleHTTPServer 80 &"
{
(_, string name, string resourceGroupName) = t;
var ip = await GetPublicIP.InvokeAsync(new GetPublicIPArgs
- {Name = name, ResourceGroupName = resourceGroupName});
+ { Name = name, ResourceGroupName = resourceGroupName });
return ip.IpAddress;
});
}
diff --git a/classic-azure-fs-aci/Azure.Aci.fsproj b/classic-azure-fs-aci/Azure.Aci.fsproj
index c6f7d45c4..da0b44764 100644
--- a/classic-azure-fs-aci/Azure.Aci.fsproj
+++ b/classic-azure-fs-aci/Azure.Aci.fsproj
@@ -12,8 +12,8 @@
-
-
+
+
diff --git a/classic-azure-fs-aci/Program.fs b/classic-azure-fs-aci/Program.fs
index 10466aecd..ca6cecbe4 100644
--- a/classic-azure-fs-aci/Program.fs
+++ b/classic-azure-fs-aci/Program.fs
@@ -6,6 +6,7 @@ open Pulumi.Azure.ContainerService
open Pulumi.Azure.ContainerService.Inputs
open Pulumi.Azure.Core
open Pulumi.Docker
+open Pulumi.Docker.Inputs
[]
module Helpers =
@@ -14,10 +15,10 @@ module Helpers =
let infra () =
let resourceGroup = ResourceGroup "aci-rg"
- let registry =
+ let registry: Registry =
Registry("registry",
- RegistryArgs
- (ResourceGroupName = io resourceGroup.Name,
+ Azure.ContainerService.RegistryArgs(
+ ResourceGroupName = io resourceGroup.Name,
AdminEnabled = input true,
Sku = input "Premium"))
@@ -26,9 +27,9 @@ let infra () =
Image("node-app",
ImageArgs
(ImageName = imageName,
- Build = inputLeft "./app",
+ Build = input (DockerBuildArgs(Dockerfile = "./app")),
Registry = input(
- ImageRegistry
+ RegistryArgs
(Server = io registry.LoginServer,
Username = io registry.AdminUsername,
Password = io registry.AdminPassword))))
diff --git a/classic-azure-fs-aci/README.md b/classic-azure-fs-aci/README.md
index 45f5d8412..d989f9b52 100644
--- a/classic-azure-fs-aci/README.md
+++ b/classic-azure-fs-aci/README.md
@@ -16,27 +16,28 @@ To deploy your infrastructure, follow the below steps.
### Steps
-1. Create a new stack:
+1. Create a new stack:
- ```
- $ pulumi stack init dev
+ ```bash
+ pulumi stack init dev
```
-1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
+1. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):
- ```
- $ az login
+ ```bash
+ az login
```
-1. Configure the location to deploy the resources to:
+1. Configure the location to deploy the resources to:
- ```
- $ pulumi config set azure:location
+ ```bash
+ pulumi config set azure:location
+ pulumi config set azure:subscriptionId
```
-1. Run `pulumi up` to preview and deploy changes:
+1. Run `pulumi up` to preview and deploy changes:
- ```
+ ```console
$ pulumi up
Previewing changes:
...
@@ -48,9 +49,9 @@ To deploy your infrastructure, follow the below steps.
Update duration: 1m56s
```
-1. Check the deployed container endpoint:
+1. Check the deployed container endpoint:
- ```
+ ```console
$ pulumi stack output endpoint
https://acifsharp.westeurope.azurecontainer.io
$ curl "$(pulumi stack output endpoint)"
@@ -63,11 +64,11 @@ To deploy your infrastructure, follow the below steps.