Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Classic v6 updates #1710

Merged
merged 10 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classic-azure-cs-botservice/Azure.BotService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

<ItemGroup>
<PackageReference Include="Pulumi" Version="3.*" />
<PackageReference Include="Pulumi.Azure" Version="4.*" />
<PackageReference Include="Pulumi.AzureAD" Version="4.*" />
<PackageReference Include="Pulumi.Azure" Version="6.*" />
<PackageReference Include="Pulumi.AzureAD" Version="6.*" />
<PackageReference Include="Pulumi.Random" Version="4.*" />
</ItemGroup>

Expand Down
52 changes: 22 additions & 30 deletions classic-azure-cs-botservice/BotStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions classic-azure-cs-botservice/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
47 changes: 24 additions & 23 deletions classic-azure-cs-botservice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <YOUR_SUBSCRIPTION_ID>
```

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:
...
Expand All @@ -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: "<secret>"
```
```yaml
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:
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
```
Loading
Loading