Skip to content

Commit

Permalink
Upgrade to v6 major (#2367)
Browse files Browse the repository at this point in the history
Fixes #2348
Fixes #2336

1. Update CI workflows
2. Update upstream (rebase patches)
3. Update provider & examples module versions
4. Generate schema & SDKs
   - Remove resources as needed.
- Add patch to remove resources that were documented as removed but left
in the code.
   - Fix nodejs CosmosDb overlay connection string.
5. Update readme
6. Move to new upgrade testing framework
7. Add tests & state migrations for enums becoming case sensitive which
could lead to replacements.

# Migration Guide

Version 6 of the Azure Classic provider is the first major release since
April 2022\. There are some breaking changes which are detailed in this
document. Version 6 of the pulumi-azure provider is based on version 4
of the terraform provider. The original release notes can be found in
the [4.0 upgrade
guide](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide).

Upgrade to version `5.89.0` of the provider and resolve any deprecation
warnings before moving to version 6\.

## Subscription ID is now mandatory

The subscription id configuration is now always required. This can be
set via the environment variable `ARM_SUBSCRIPTION_ID` or the provider
configuration property `subscriptionId`. This was already required when
using any authentication method except for the CLI.

## Provider Registration Options

The previous version of the provider would automatically register a
predefined list of resource providers in Azure, unless disabled with the
`skipProviderRegistration` configuration option.

In version 6, the default set of resource providers is reduced to a
smaller default set with the option to specify an alternative
pre-defined set and specify a custom list of resource providers.

* `resourceProviderRegistrations` is the name of the set of resource
providers to automatically register.
* `core` \- A minimal set of RPs that are deemed necessary for a
subscription, the list of RPs in this set can be found upstream
[here](https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/resourceproviders/required.go#L33-L44)
* `extended` \- An expanded set of RPs as suggested by the community,
the list of RPs in this set can be found upstream
[here](https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/resourceproviders/required.go#L47-L91)
* `all` \- A complete set of RPs that might be needed to utilize any
functionality in the provider, the list of RPs in this set can be found
upstream
[here](https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/resourceproviders/required.go#L47-L91)
  * `none` \- No resource providers should be automatically registered  
* `legacy` \- A set of automatically registered RPs from earlier
versions of the provider, this is only provided for forwards
compatibility and will be removed in a future major version release
* `resourceProvidersToRegisters` is a list of resource provider names to
register in addition to the set specified with
`resourceProviderRegistrations`

## Case Sensitive Enums

In [the previous upstream version enum strings were made case
sensitive](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/3.0-upgrade-guide#case-sensitivity-changes)
for better strictness and to resolve some persistent diff issues. We
delayed passing on this change until this next major version to ensure
we had a good migration experience which could avoid fixing the case
causing replacements.

Once you have upgraded to v6, performing a preview will report any
properties with incorrect casing and will indicate the allowed values.
The casing will need to be fixed in your program before being able to
continue with your deployment.

### List of resource properties affected

| Resource | Properties |
| :---- | :---- |
| `appservice.AppService` | `dotnetFrameworkVersion`<br
/>`javaContainer`<br />`managedPipelineMode`<br
/>`remoteDebuggingVersion` |
| `appservice.CertificateOrder` | `productType` |
| `appservice.FunctionApp` | `dotnetFrameworkVersion` |
| `analysisservices.Server` | `querypoolConnectionMode` |
| `automation.RunBook` | `runbookType` |
| `automation.Schedule` | `frequency`<br />`weekDays`<br
/>`monthlyOccurrence` |
| `cdn.Endpoint` | `geoFilters.action`<br />`optimizationType` |
| `cdn.Profile` | `sku` |
| `compute.Image` | `osDisk.osType`<br />`osDisk.osState`<br
/>`osDisk.caching`<br />`dataDisk.caching` |
| `compute.Snapshot` | `createOption` |
| `compute.VirtualMachineDataDiskAttachment` | `caching`<br
/>`createOption` |
| `containers.ContainerGroup` | `ipAddressType`<br />`osType`<br
/>`restartPolicy` |
| `containers.KubernetesCluster` | `loadBalancerSku` |
| `cosmos.Account` | `offerType`<br />`kind`<br
/>`consistencyPolicy.consistencyLevel`<br />`capabilities.name` |
| `cosmos.GremlinGraph` | `indexingMode` |
| `dns.CaaRecord` | `record.tag` |
| `eventhub.Namespace` | `sku` |
| `eventhub.EventHub` | `encoding` |
| `network.FirewallPolicy` |
`intrusionDetection.trafficBypasses.protocol` |
| `hdinsight.HBaseCluster` | `tier`<br />`roles.*.vmSize` |
| `hdinsight.HadoopCluster` | `tier`<br />`roles.*.vmSize` |
| `hdinsight.InteractiveQueryCluster` | `tier`<br />`roles.*.vmSize` |
| `hdinsight.KafkaCluster` | `tier`<br />`roles.*.vmSize` |
| `hdinsight.SparkCluster` | `tier`<br />`roles.*.vmSize` |
| `iotcentral.Application` | `sku` |
| `iot.IoTHub` | `endpoint.encoding` |
| `keyvault.Certificate` | `certificatePolicy.keyProperties.keyType` |
| `compute.VirtualMachine` | `licenseType`<br
/>`storageOsDisk.osType`<br />`storageOsDisk.managedDiskType`<br
/>`storageDataDisk.managedDiskType`<br
/>`osProfileWindowsConfig.winrm.protocol` |
| `compute.ScaleSet` | `licenseType`<br />`upgradePolicyMode`<br
/>`priority`<br />`storageProfileOsDisk.managedDiskType`<br
/>`storageProfileDataDisk.managedDiskType` |
| `lb.LoadBalancer` | `sku` |
| `lb.NatPool` | `protocol` |
| `lb.NatRule` | `protocol` |
| `lb.Probe` | `protocol` |
| `lb.Rule` | `protocol` |
| `loganalytics.DataSourceWindowsEvent` | `eventTypes` |
| `logic.IntegrationAccountBatchConfiguration` |
`recurrence.frequency`<br />`recurrence.schedule.monthly.weekday`<br
/>`recurrence.schedule.weekDays` |
| `logic.Standard` | `connectionString.type`<br
/>`dotnetFrameworkVersion` |
| `logz.Monitor` | `plan.billingCycle`<br />`plan.planId`<br
/>`plan.usageType` |
| `media.ServicesAccount` | `storageAuthenticationType`<br
/>`keyDeliveryAccessControl.defaultAction` |
| `monitor.MonitorAutoscaleSetting` | `profile.recurrence.days` |
| `mssql.Database` | `threatDetectionPolicy.disabledAlerts`<br
/>`threatDetectionPolicy.emailAccountAdmins`<br
/>`threatDetectionPolicy.state` |
| `mssql.Elasticpool` | `sku.name`<br />`sku.tier`<br />`sku.family` |
| `mssql.ServerSecurityAlertPolicy` | `state` |
| `mysql.Server` | `version` |
| `network.ApplicationGateway` | `backendHttpSettings.protocol`<br
/>`backendHttpSettings.cookieBasedAffinity`<br
/>`frontendIpConfiguration.privateIpAddressAllocation`<br
/>`httpListener.protocol`<br
/>`privateLinkConfiguration.ipConfiguration.privateIpAddressAllocation`<br
/>`sku.name`<br />`sku.tier`<br />`probe.protocol`<br
/>`wafConfiguration.firewallMode` |
| `network.ExpressRouteCircuit` | `sku.tier`<br />`sku.family` |
| `network.NetworkSecurityGroup` | `securityRule.protocol`<br
/>`securityRule.access`<br />`securityRule.direction` |
| `network.NetworkSecurityRule` | `protocol`<br />`access`<br
/>`direction` |
| `network.PublicIpPrefix` | `ipVersion` |
| `network.PublicIp` | `ipVersion`<br />`sku` |
| `network.Route` | `nextHopType` |
| `network.RouteTable` | `nextHopType` |
| `network.VirtualNetworkGatewayConnection` | `type`<br
/>`ipsecPolicy.dhGroup`<br />`ipsecPolicy.ikeEncryption`<br
/>`ipsecPolicy.ikeIntegrity` |
| `network.VirtualNetworkGateway` | `type`<br />`vpnType`<br
/>`vpnClientConfiguration.vpnClientProtocols` |
| `notificationhub.NotificationHubNamespace` | `namespaceType` |
| `policy.PolicyDefinition` | `policyType` |
| `postgresql.Server` | `version` |
| `recoveryservices.Vault` | `sku` |
| `recoveryservices.ReplicatedVM` | `targetDiskType`<br
/>`targetReplicaDiskType` |
| `redis.Cache` | `skuName` |
| `redis.LinkedServer` | `serverRole` |
| `securitycenter.Automation` | `action.type`<br
/>`ruleSet.rule.operator`<br />`ruleSet.rule.propertyType` |
| `servicebus.Namespace` | `sku` |
| `servicebus.SubscriptionRule` | `filterType` |
| `servicebus.Topic` | `status` |
| `sql.Database` | `createMode`<br />`import.storageKeyType`<br
/>`import.authenticationType`<br />`import.operationMode`<br
/>`edition`<br />`threatDetectionPolicy.disabledAlerts`<br
/>`threatDetectionPolicy.emailAccountAdmins`<br
/>`threatDetectionPolicy.state` |
| `sql.ManagedInstance` | `licenseType` |
| `sql.SqlServer` | `threatDetectionPolicy.disabledAlerts`<br
/>`threatDetectionPolicy.state` |
| `storage.Account` | `accountKind`<br />`accountTier`<br
/>`accountReplicationType`<br />`accessTier`<br />`networkRules.bypass`
|
| `synapse.SqlPoolSecurityAlertPolicy` | `policyState` |
| `synapse.WorkspaceSecurityAlertPolicy` | `policyState` |
| `trafficmanager.Profile` | `monitorConfig.protocol`<br
/>`profileStatus` |

## Removed Resources

Resources which were previously deprecated have now been removed. Some
removed resources have direct replacements which can be directly
migrated to by updating your code. Other services have been retired by
Azure and therefore have no direct migration to an alternative.

### Replaced Resources

These resources were previously deprecated and have now been removed in
favor of a new resource. To migrate to the replacement resource, update
your Pulumi program to use the new type, leaving the [logical
name](https://www.pulumi.com/docs/iac/concepts/resources/names/#logicalname)
the same, and fix any properties which don’t align, then your existing
resource will automatically be migrated.

| Removed Resource | Replacement Resource |
| :---- | :---- |
| `core.TemplateDeployment` | `core.ResourceGroupTemplateDeployment` |
| `portal.Dashboard` | `portal.PortalDashboard` |
| `databricks.WorkspaceCustomerManagedKey` |
`databricks.WorkspaceRootDbfsCustomerManagedKey` |
| `datafactory.IntegrationRuntimeManaged` |
`datafactory.IntegrationRuntimeSsis` |
| `graph.Account` | `graph.ServicesAccount` |
| `monitoring.ActionRuleActionGroup` |
`monitoring.AlertProcessingRuleActionGroup` |
| `monitoring.ActionRuleSuppression` |
`monitoring.AlertProcessingRuleSuppression` |
| `sql.Database` | `mssql.Database` |
| `sql.ElasticPool` | `mssql.ElasticPool` |
| `sql.FailoverGroup` | `mssql.FailoverGroup` |
| `sql.FirewallRule` | `mssql.FirewallRule` |
| `sql.ManagedDatabase` | `mssql.ManagedDatabase` |
| `sql.ManagedInstanceActiveDirectoryAdministrator` |
`mssql.ManagedInstanceActiveDirectoryAdministrator` |
| `sql.ManagedInstanceFailoverGroup` |
`mssql.ManagedInstanceFailoverGroup` |
| `sql.ManagedInstance` | `mssql.ManagedInstance` |
| `sql.SqlServer` | `mssql.Server` |
| `sql.VirtualNetworkRule` | `mssql.VirtualNetworkRule` |

### Replaced Data Sources

| Removed Data Source | Replacement Data Source |
| :---- | :---- |
| `hybrid.getComputeMachine` | `arcmachine.get` |

### Retired Resources

These resource do not have a direct replacement and the old resource
will need to be deleted or [removed from
state](https://www.pulumi.com/docs/iac/cli/commands/pulumi_state_delete/)
then recreated using alternative resources.

| Retired Resource | Notes |
| :---- | :---- |
| `appservice.Environment` | This resource covered App Service
Environment v1 and v2 which were retired on 2024-08-31. ASE v3 is
current, and covered by appservice.EnvironmentV3. |
| `cdn.FrontdoorRouteDisableLinkToDefaultDomain` | This resource is
superseded by the linkToDefaultDomain property in the cdn.FrontdoorRoute
resource. |
| `cosmosdb.NotebookWorkspace` | CosmosDb Notebook Workspace is
deprecated by Azure and only offers short-lived notebooks at this point.
|
| `databoxedge.Order` | The creation of DataBox Edge Orders is not
supported by the Azure API. |
| `servicebus.NamespaceNetworkRuleSet` | This resource is superseded by
the networkRuleSet property in the servicebus.Namespace resource. |
| `sql.ActiveDirectoryAdministrator` | This resource is superseded by
the azureadAdministrator property in the mssql.Server resource. |

### Retired Services

| Service | Resources | Notes |
| :---- | :---- | :---- |
| `iot` | `TimeSeriesInsightsAccessPolicy`<br
/>`TimeSeriesInsightsEventSourceEventhub`<br
/>`TimeSeriesInsightsEventSourceIothub`<br
/>`TimeSeriesInsightsGen2Environment`<br
/>`TimeSeriesInsightsReferenceDataSet`<br
/>`TimeSeriesInsightsStandardEnvironment` | This Azure Service will be
retired on 2025-03-31. |
| `lab` | `Lab`<br />`Schedule`<br />`ServicePlan`<br />`User` | This
Azure service is deprecated and on the road to retirement. |
| `monitoring` | `LogzMonitor`<br />`LogzSubAccount`<br
/>`LogzSubAccountTagRule`<br />`LogzTagRule` | This Azure service is
being retired. |
| `mariadb` | `Configuration`<br />`Database`<br />`FirewallRule`<br
/>`Server`<br />`VirtualNetworkRule`<br />`getMariaDbServer` | This
service is replaced by MySQL Flexible Server. |
| `media` | `AccountFilter`<br />`AssetFilter`<br />`Asset`<br
/>`ContentKeyPolicy`<br />`Job`<br />`LiveEvent`<br
/>`LiveEventOutput`<br />`ServiceAccount`<br />`StreamingEndpoint`<br
/>`StreamingLocator`<br />`StreamingPolicy`<br />`Transform` | [Azure
Media Services was retired June 30th,
2024](https://learn.microsoft.com/en-us/azure/media-services/latest/azure-media-services-retirement).
|
| `mediaservices` | `Account` | [Azure Media Services was retired June
30th,
2024](https://learn.microsoft.com/en-us/azure/media-services/latest/azure-media-services-retirement).
|
| `mysql` | `ActiveDirectoryAdministrator`<br />`Configuration`<br
/>`Database`<br />`FirewallRule`<br />`Server`<br />`ServerKey`<br
/>`VirtualNetworkRule`<br />`getServer` | Azure Database for MySQL
Single Server was retired on 2024-09-16 and users should migrate to
Azure Database for MySQL Flexible Server. |
| `videoanalyzer` | `Analyzer`<br />`EdgeModule` | This service was
retired in June 2024\. |

## Resource Property Breaking Changes

About 150 resources saw changes to properties that might require a
manual update. For the full list please see the [upstream upgrade
guide](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#behaviour-changes-and-removed-properties-in-resources).

* 16 properties are no longer “Computed”. If you experience a diff as a
result of this change you may need to use
[ignoreChanges](https://www.pulumi.com/docs/iac/concepts/options/ignorechanges/).
* 31 properties had their default value updated.
* 4 resources have new properties that are required, so you’ll need to
add them if you use these resources.
* 32 deprecated properties were removed (10 from KubernetesCluster).  
* The other changes are properties that were renamed or replaced by a
related property.

## Other

Instances of the `apimanagement.ApiTag` resource will need to be
recreated upon upgrading so that the tag revision can be included in the
resource ID.
  • Loading branch information
danielrbradley committed Sep 23, 2024
2 parents 0f86fd5 + acb0829 commit 1892762
Show file tree
Hide file tree
Showing 5,225 changed files with 172,739 additions and 601,127 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .ci-mgmt.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider: azure
major-version: 5
major-version: 6
parallel: 1
timeout: 90
generate-nightly-test-workflow: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea
.code
.vscode
**/vendor/
.pulumi
**/bin/
Expand Down
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ linters-settings:
- prefix(github.com/pulumi/) # Custom section: groups all imports with the github.com/pulumi/ prefix.
- prefix(github.com/pulumi/pulumi-azure) # Custom section: local imports
custom-order: true
misspell:
ignore-words:
- hdinsight
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PACK := azure
ORG := pulumi
PROJECT := github.com/$(ORG)/pulumi-$(PACK)
PROVIDER_PATH := provider/v5
PROVIDER_PATH := provider/v6
VERSION_PATH := $(PROVIDER_PATH)/pkg/version.Version
TFGEN := pulumi-tfgen-$(PACK)
PROVIDER := pulumi-resource-$(PACK)
Expand All @@ -16,7 +16,7 @@ PULUMI_MISSING_DOCS_ERROR := true

# Override during CI using `make [TARGET] PROVIDER_VERSION=""` or by setting a PROVIDER_VERSION environment variable
# Local & branch builds will just used this fixed default version unless specified
PROVIDER_VERSION ?= 5.0.0-alpha.0+dev
PROVIDER_VERSION ?= 6.0.0-alpha.0+dev
# Use this normalised version everywhere rather than the raw input to ensure consistency.
VERSION_GENERIC = $(shell pulumictl convert-version --language generic --version "$(PROVIDER_VERSION)")

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![NPM version](https://badge.fury.io/js/%40pulumi%2Fazure.svg)](https://npmjs.com/package/@pulumi/azure)
[![Python version](https://badge.fury.io/py/pulumi-azure.svg)](https://pypi.org/project/pulumi-azure)
[![NuGet version](https://badge.fury.io/nu/pulumi.azure.svg)](https://badge.fury.io/nu/pulumi.azure)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pulumi/pulumi-azure/sdk/v5/go)](https://pkg.go.dev/github.com/pulumi/pulumi-azure/sdk/v5/go)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/pulumi/pulumi-azure/sdk/v6/go)](https://pkg.go.dev/github.com/pulumi/pulumi-azure/sdk/v6/go)
[![License](https://img.shields.io/npm/l/%40pulumi%2Fpulumi.svg)](https://github.com/pulumi/pulumi-azure/blob/master/LICENSE)

# Microsoft Azure Resource Provider
Expand All @@ -29,29 +29,29 @@ This package is available in many languages in the standard packaging formats.

To use from JavaScript or TypeScript in Node.js, install using either `npm`:

$ npm install @pulumi/azure
npm install @pulumi/azure

or `yarn`:

$ yarn add @pulumi/azure
yarn add @pulumi/azure

### Python

To use from Python, install using `pip`:

$ pip install pulumi_azure
pip install pulumi_azure

### Go

To use from Go, use `go get` to grab the latest version of the library

$ go get github.com/pulumi/pulumi-azure/sdk/v5
go get github.com/pulumi/pulumi-azure/sdk/v6

### .NET
### .NET

To use from .NET, install using `dotnet add package`:

$ dotnet add package Pulumi.Azure
dotnet add package Pulumi.Azure

## Concepts

Expand Down
49 changes: 49 additions & 0 deletions docs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Azure Classic
meta_desc: Learn how to use Pulumi's Azure Classic Provider to reduce the complexity of managing and provisioning Azure resources with Azure Resource Manager (ARM) APIs.
layout: package
---

{{% notes %}}
We recommend using the [Azure Native provider](/registry/packages/azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates because it’s built and automatically from the Azure Resource Manager API.

Azure Classic is based on the Terraform AzureRM provider. It has fewer resources and resource options and receives new Azure features more slowly than Azure Native. However, Azure Classic remains fully supported for existing usage.
{{% /notes %}}

The Azure Classic provider for Pulumi can be used to provision many of the cloud resources available in [Azure](https://azure.microsoft.com/en-us/). It manages and provisions resources using the [Azure Resource Manager (ARM) APIs](https://docs.microsoft.com/en-us/rest/api/resources/).

Azure Classic must be configured with credentials to deploy and update resources in Azure; see [Installation & Configuration](./installation-configuration) for instructions.

If you're upgrading from v5 to v6, please refer to the [v6 migration guide](./v6-migration).

## Example

{{< chooser language "typescript,yaml" >}}

{{% choosable language typescript %}}

```typescript
const azure = require("@pulumi/azure")

const resourceGroupName = new azure.core.ResourceGroup("my-group", {
location: "westus2",
});
```

{{% /choosable %}}

{{% choosable language yaml %}}

```yaml
resources:
my-group:
type: azure:core:ResourceGroup
properties:
location: westus2
```
{{% /choosable %}}
{{% /chooser %}}
Visit the [How-to Guides](./how-to-guides) to find step-by-step guides for specific scenarios like running an app in Azure App Service or setting up a serverless Azure Function.
6 changes: 6 additions & 0 deletions docs/how-to-guides/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Azure Classic How-to Guides
meta_desc: |
Tutorials for using infrastructure as code in the Pulumi Azure Classic package
layout: package
---
109 changes: 109 additions & 0 deletions docs/how-to-guides/classic-azure-cs-botservice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
title: "Azure Bot Service with Application Insights | C#"
h1: "Azure Bot Service with Application Insights"
linktitle: "Azure Bot Service with Application Insights"
meta_desc: "Azure Bot Service with Application Insights How-to Guide using C#"
no_edit_this_page: true
cloud: classic-azure
language: cs
layout: package
---

<!-- WARNING: this page was generated by a tool. Do not edit it by hand. -->
<!-- To change it, please see https://github.com/pulumi/registry/tree/master/tools/mktutorial. -->

<p class="mb-4 inline-flex items-center">
<a class="rounded-md font-display text-lg text-white bg-white border-2 border-blue-600 px-3 mr-2 whitespace-no-wrap hover:text-white" style="height: 45px; line-height: 41px;" href="https://github.com/pulumi/examples/tree/master/classic-azure-cs-botservice" target="_blank">
<span class="flex items-center">
<i class="fab fa-github pr-1.5"></i>
<span>View Code</span>
</span>
</a>
<a href="https://app.pulumi.com/new?template=https://github.com/pulumi/examples/blob/master/classic-azure-cs-botservice/README.md" target="_blank">
<img src="https://get.pulumi.com/new/button.svg" alt="Deploy this example with Pulumi">
</a>
</p>


Starting point for building Azure Bot Service hosted in Azure App Service.

Provisions Azure Bot Service, Azure Bot Channel registration and Azure Application Insights to be used in combination
with App Service - registering Azure AD Microsoft Application with secret.

This will deploy the echo bot code within the ~/bot directory - you can tweak the contents or replace the contents with your own bot. Please ensure you publish the bot first to the ~/bot/publish subfolder - following the instructions for `Publish Bot Steps`.

## Deploying the App

To deploy your infrastructure, follow the below steps.

### Prerequisites

* [Install Pulumi](https://www.pulumi.com/docs/get-started/install/)
* [Install .NET Core 3.0+](https://dotnet.microsoft.com/download)

### Publish Bot Steps

1. Within the **/bot** subfolder, publish the bot to subfolder called publish:

```bash
$ dotnet publish -o publish
```

### Pulumi Steps

1. Within the **azure-cs-botservice** folder, create a new stack:

```bash
$ pulumi stack init dev
```

2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

```bash
$ az login
```

3. Configure the location to deploy the resources to:

```bash
$ pulumi config set azure:location "North Europe"
```

4. Configure the Bot Name:

```bash
$ pulumi config set botName PulumiBot1
```

5. Run `pulumi up` to preview and deploy changes:

```bash
$ pulumi up
Previewing changes:
...
Performing changes:
...
info: 14 changes performed:
+ 14 resources created
Update duration: 1m22s
```

6. 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:

```bash
$ BotEndpoint: "https://app8asdf.azurewebsites.net/api/messages"
$ MicrosoftAppId: "b5e65403-923c-4568-z2f6-a6f41b258azz"
$ MicrosoftAppPassword: "<secret>"
```

7. 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
```

119 changes: 119 additions & 0 deletions docs/how-to-guides/classic-azure-cs-cosmosapp-component.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: "Reusable Component to Create Globally-distributed Applications with Azure Cosmos DB | C#"
h1: "Reusable Component to Create Globally-distributed Applications with Azure Cosmos DB"
linktitle: "Reusable Component to Create Globally-distributed Applications with Azure Cosmos DB"
meta_desc: "Reusable Component to Create Globally-distributed Applications with Azure Cosmos DB How-to Guide using C#"
no_edit_this_page: true
cloud: classic-azure
language: cs
layout: package
---

<!-- WARNING: this page was generated by a tool. Do not edit it by hand. -->
<!-- To change it, please see https://github.com/pulumi/registry/tree/master/tools/mktutorial. -->

<p class="mb-4 inline-flex items-center">
<a class="rounded-md font-display text-lg text-white bg-white border-2 border-blue-600 px-3 mr-2 whitespace-no-wrap hover:text-white" style="height: 45px; line-height: 41px;" href="https://github.com/pulumi/examples/tree/master/classic-azure-cs-cosmosapp-component" target="_blank">
<span class="flex items-center">
<i class="fab fa-github pr-1.5"></i>
<span>View Code</span>
</span>
</a>
<a href="https://app.pulumi.com/new?template=https://github.com/pulumi/examples/blob/master/classic-azure-cs-cosmosapp-component/README.md" target="_blank">
<img src="https://get.pulumi.com/new/button.svg" alt="Deploy this example with Pulumi">
</a>
</p>


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`](https://github.com/pulumi/examples/blob/master/classic-azure-cs-cosmosapp-component/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
```

Loading

0 comments on commit 1892762

Please sign in to comment.