Skip to content

Commit

Permalink
apply PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
JhontSouth committed Oct 10, 2023
1 parent da6a85a commit 7caacfe
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ A [collection of **experimental** samples](./experimental) exist, intended to pr
[js#81]:samples/javascript_nodejs/81.skills-skilldialog
[js#82]:samples/javascript_nodejs/82.skills-sso-cloudadapter
[js#84]:samples/javascript_nodejs/84.bot-authentication-certificate
[js#85]:samples/javascript_nodejs/84.bot-authentication-sni
[js#85]:samples/javascript_nodejs/85.bot-authentication-sni

[py#1]:samples/python/01.console-echo
[py#2]:samples/python/02.echo-bot
Expand Down
2 changes: 0 additions & 2 deletions samples/javascript_nodejs/85.bot-authentication-sni/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
MicrosoftAppType=
MicrosoftAppId=
MicrosoftAppPassword=
MicrosoftAppTenantId=
CertificateThumbprint=
KeyVaultName=
Expand Down
68 changes: 56 additions & 12 deletions samples/javascript_nodejs/85.bot-authentication-sni/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ This bot has been created using [Bot Framework](https://dev.botframework.com/),

```bash



# determine node version



node --version



```

## To try this sample
Expand All @@ -22,32 +28,60 @@ node --version

```bash



git clone https://github.com/microsoft/botbuilder-samples.git



```

- In a terminal, navigate to `samples/javascript_nodejs/85.bot-authentication-sni`

```bash



cd samples/javascript_nodejs/85.bot-authentication-sni



```

- Install modules

```bash



npm install



```

- Set environment variables

- MicrosoftAppId: App Id of your bot.

- MicrosoftAppTenantId: Tenant Id to which your bot belongs.

- CertificateThumbprint: Certificate thumbprint.

- KeyVaultName: Name of the KeyVault containing the certificate.

- CertificateName: Name of the certificate in the KeyVault.

- Start the bot

```bash



npm start



```

## Testing the bot using Bot Framework Emulator
Expand Down Expand Up @@ -78,29 +112,39 @@ There are two possible options to create SSL/TSL certificate. Below is a step-by

### Using local environment

1. Run the following command in a local PowerShell
1. Run the following command in a local PowerShell

```
$cert = New-SelfSignedCertificate -CertStoreLocation "Cert:\CurrentUser\My" -Subject "CN=sampleAppCert" -KeySpec KeyExchange
$cert = New-SelfSignedCertificate -CertStoreLocation "<directory-to-store-certificate>" -Subject "CN=<certificate-name>" -KeySpec KeyExchange
```

1. Then, type _Manage User Certificates_ in the Windows search bar and hit enter
2. The certificate will be in the _user certificates_ folder, under _personal_.
3. Export the certificate to _pfx_ format including the key(The default location is _system32_ folder).
4. Go to the certificate location and run the following command to generate a _pem_ file:
1. Then, type _Manage User Certificates_ in the Windows search bar and hit enter

2. The certificate will be located in the _user certificates_ folder, under _personal_ directory.

3. Export the certificate to _pfx_ format including the key(The default location is _system32_ folder).

4. Go to the certificate location and run the following command to generate a _pem_ file:

```
OpenSSL pkcs12 -in sampleAppCert.pfx -out c:\sampleAppCert.pem –nodes
OpenSSL pkcs12 -in <certificate-name>.pfx -out c:\<certificate-name>.pem –nodes
```

5. Upload the generated certificate to the Azure app registration.
5. Upload the generated certificate to the Azure app registration.

### Using KeyVault

1. Create a KeyVault resource and assign _the KeyVault Administrator_ role to have permission to create a new certificate.
2. Under the Certificates section, hit on Generate/Import, complete the form, and create the certificate in PEM format.
3. Go to the details of the certificate that you created and enable it.
4. Download the certificate in CER format and then upload it to the Azure app registration.
1. Create a KeyVault resource and assign _the KeyVault Administrator_ role to have permission to create a new certificate.

2. Under the Certificates section, hit on Generate/Import, complete the form, and create the certificate in PEM format.

3. Go to the details of the certificate that you created and enable it.

4. Download the certificate in CER format and then upload it to the Azure app registration.

## Deploy the bot to Azure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@azure/identity": "^3.3.0",
"@azure/keyvault-certificates": "^4.7.0",
"@azure/keyvault-secrets": "^4.7.0",
"botbuilder": "~4.20.0",
"botbuilder": "~4.21.0",
"dotenv": "^8.2.0",
"restify": "~8.6.0"
},
Expand Down

0 comments on commit 7caacfe

Please sign in to comment.