Skip to content

Commit d5f4a24

Browse files
committed
Updates to setup and documentation due to Key Vault and other changes
1 parent 0e776dc commit d5f4a24

22 files changed

+295
-184
lines changed

documentation/api-management.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Gateway using API Management
22

3-
- [Next steps](#next-steps)
3+
- [Gateway using API Management](#gateway-using-api-management)
4+
- [Next steps](#next-steps)
45

56
There are many benefits to using an API manager. In the case the Rideshare solution, there are really four major benefits:
67

@@ -112,7 +113,7 @@ public static async Task<IActionResult> GetDrivers([HttpTrigger(AuthorizationLev
112113

113114
4. **Rate Limiting**: the API manager can be configured to rate limit APIs based on IP origin, access, etc. This can be useful to prevent DOD attacks or provide different tiers of access based on users.
114115

115-
**Please note** that, in the case of Azure Functions, while the APIs are front-ended with an API manager (and hence shielded, protected, and rate limited), the APIs are still publicly available. This means that a DDOS attack or other attacks can still happen against the bare APIs if someone discovers them in the wild.
116+
**Please note** that, in the case of Azure Functions, while the APIs are front-ended with an API manager (and hence shielded, protected, and rate limited), the APIs are still publicly available. This means that a DDOS attack or other attacks can still happen against the bare APIs if someone discovers them in the wild. However, you can restrict access to your Function Apps by [only allowing access to your API Management's static IP](https://docs.microsoft.com/azure/app-service/app-service-ip-restrictions) address. When you do this, only traffic that flows through API Management will be able to access your functions.
116117

117118
## Next steps
118119

documentation/architecture-overview.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Architecture overview
22

3-
- [Macro architecture](#macro-architecture)
4-
- [Data flow](#data-flow)
5-
- [Next steps](#next-steps)
3+
- [Architecture overview](#architecture-overview)
4+
- [Macro architecture](#macro-architecture)
5+
- [Data flow](#data-flow)
6+
- [Next steps](#next-steps)
67

78
## Macro architecture
89

@@ -12,14 +13,15 @@ Relecloud decided to use the following macro architecture in their RideShare sol
1213

1314
The architecture major building blocks are:
1415

15-
| Component | Technology | Description |
16-
| --------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
17-
| RideShare Web App | Vue.js SPA | A multi-purpose, single-page application web app that allows users to sign up and sign in against a B2C Active Directory instance. Users have different levels and permissions. For example, passenger users can request rides and receive real-time notifications of ride status. Executive users, on the other hand, can view top-level reports that reveal rides and system performance |
18-
| API Manager | [Azure API Manager](https://docs.microsoft.com/azure/api-management/) | An API gateway that acts as a front-end to the solution APIs. Among many other benefits, the API management service provides RideShare APIs with security verification, usage telemetry, documentation and rate limiting. |
19-
| RideShare APIs | C# [Azure Functions](https://azure.microsoft.com/services/functions/) | Three Function Apps are deployed to serve RideShare's APIs: Drivers, Trips and Passengers. These APIs are exposed to the Web App applications via the API manager and provide CRUD operations for each of RideShare entities |
20-
| Durable Orchestrators | C# [Durable Functions](https://docs.microsoft.com/azure/azure-functions/durable-functions-overview) | Trip Manager, Monitor and Demo orchestrators are deployed to manage the trip and provide real-time status updates. The orchestrators are launched for the duration of the trip and they perform management and monitoring functions as will be explained in more [details](#durable-orchestrators) later. In essence, these orchestrators make up the heart of the solution. |
21-
| Event Emitter | [Event Grid Topic](https://docs.microsoft.com/azure/event-grid/overview) | A custom topic used to externalize trips as they go through the different stages. |
22-
| Event Subscribers | Functions & Logic Apps | Several Event Grid topic subscribers listen to the Event Grid topic events to provide multi-process capability of an externalized trip |
16+
| Component | Technology | Description |
17+
| --------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
18+
| RideShare Web App | Vue.js SPA | A multi-purpose, single-page application web app that allows users to sign up and sign in against a B2C Active Directory instance. Users have different levels and permissions. For example, passenger users can request rides and receive real-time notifications of ride status. Executive users, on the other hand, can view top-level reports that reveal rides and system performance. |
19+
| API Manager | [Azure API Manager](https://docs.microsoft.com/azure/api-management/) | An API gateway that acts as a front-end to the solution APIs. Among many other benefits, the API management service provides RideShare APIs with security verification, usage telemetry, documentation and rate limiting. |
20+
| RideShare APIs | C# [Azure Functions](https://azure.microsoft.com/services/functions/) | Three Function Apps are deployed to serve RideShare's APIs: Drivers, Trips and Passengers. These APIs are exposed to the Web App applications via the API manager and provide CRUD operations for each of RideShare entities. |
21+
| Durable Orchestrators | C# [Durable Functions](https://docs.microsoft.com/azure/azure-functions/durable-functions-overview) | Trip Manager, Monitor and Demo orchestrators are deployed to manage the trip and provide real-time status updates. The orchestrators are launched for the duration of the trip and they perform management and monitoring functions as will be explained in more [details](#durable-orchestrators) later. In essence, these orchestrators make up the heart of the solution. |
22+
| Event Emitter | [Event Grid Topic](https://docs.microsoft.com/azure/event-grid/overview) | A custom topic used to externalize trips as they go through the different stages. |
23+
| Event Subscribers | Functions & Logic Apps | Several Event Grid topic subscribers listen to the Event Grid topic events to provide multi-process capability of an externalized trip. |
24+
| Key Vault | [Azure Key Vault](https://docs.microsoft.com/azure/key-vault/key-vault-overview) | All secrets, such as database connection strings and keys are securely stored in Azure Key Vault. This prevents accidental leakage of sensitive values and the same keys can be easily shared by multiple services. |
2325

2426
The following are the Event Grid Subscribers:
2527

27.3 KB
Loading

documentation/media/apim-browse.png

28.7 KB
Loading
Loading
121 KB
Loading
121 KB
Loading
24.7 KB
Loading
Loading
49 KB
Loading
Loading
Loading
53.3 KB
Loading
57.8 KB
Loading
Loading
54.5 KB
Loading
Loading
Loading
100 KB
Loading
47.3 KB
Loading

documentation/services-intercommunication.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Services intercommunication using Event Grid
22

3-
- [Logic App handler](#logic-app-handler)
4-
- [SignalR handler](#signalr-handler)
5-
- [DOTNET SignalR client](#dotnet-signalr-client)
6-
- [JavaScript SignalR client](#javascript-signalr-client)
7-
- [Power BI handler](#power-bi-handler)
8-
- [Trip Archiver handler](#trip-archiver-handler)
9-
- [Next steps](#next-steps)
3+
- [Services intercommunication using Event Grid](#services-intercommunication-using-event-grid)
4+
- [Event Grid](#event-grid)
5+
- [Logic App handler](#logic-app-handler)
6+
- [SignalR handler](#signalr-handler)
7+
- [DOTNET SignalR client](#dotnet-signalr-client)
8+
- [JavaScript SignalR client](#javascript-signalr-client)
9+
- [Power BI handler](#power-bi-handler)
10+
- [Trip Archiver handler](#trip-archiver-handler)
11+
- [Next steps](#next-steps)
1012

1113
## Event Grid
1214

@@ -149,6 +151,7 @@ public static async Task ProcessTripExternalizations2SignalR([EventGridTrigger]
149151
log.LogInformation($"ProcessTripExternalizations2SignalR firing SignalR `{clientMethod}` client method!");
150152
await signalRMessages.AddAsync(new SignalRMessage()
151153
{
154+
UserId = trip.Passenger.Code,
152155
Target = clientMethod,
153156
Arguments = new object[] { trip}
154157
});
@@ -164,7 +167,7 @@ public static async Task ProcessTripExternalizations2SignalR([EventGridTrigger]
164167

165168
**Please note** that, in the reference implementation, `EVGH_` is added to the function name that handles an Event Grid event i.e. `EVGH_TripExternalizations2SignalR`.
166169

167-
When an Event Grid Topic event arrives at the SignalR processor, it extracts the `TripItem` from the event data and calls different client methods based on the event subject to notify SignalR clients, in real-time, of trip state changes.
170+
When an Event Grid Topic event arrives at the SignalR processor, it extracts the `TripItem` from the event data and calls different client methods based on the event subject to notify SignalR clients, in real-time, of trip state changes. The `UserId` value tells the SignalR Service which client should receive the message so it will not be sent to every connected user.
168171

169172
In this reference implementation, the SignalR client is the Web App SPA. But a Xamarin Mobile App or .NET client can also receive SignalR messages. When a client receives a SignalR message, they change the trip state so passengers and drivers become aware of the latest trip status.
170173

@@ -235,12 +238,12 @@ Console.WriteLine("SignalR client started....waiting for messages from server. T
235238
Console.ReadLine();
236239
```
237240

238-
Where `GetSignalRInfo` retrieves via a `Get` operation the `SignalR Info` from a Function also defined in the `Trips Function App`:
241+
Where `GetSignalRInfo` retrieves via a `Get` operation the `SignalR Info` from a Function also defined in the `Trips Function App`. Notice that the `SignalRConnectionInfo` binding contains a `HubName` parameter to define the SignalR hub, and a `UserId` parameter that defines the request header value used to retrieve the requestor's User ID value. When you pass a User ID to this method, then you are able to target messages just to that user so it doesn't appear for all users. This is useful when sending trip-related messages, as you would not want those to display on every user's screen.
239242

240243
```csharp
241244
[FunctionName("GetSignalRInfo")]
242245
public static IActionResult GetSignalRInfo([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "signalrinfo")] HttpRequest req,
243-
[SignalRConnectionInfo(HubName = "trips")] AzureSignalRConnectionInfo info,
246+
[SignalRConnectionInfo(HubName = "trips", UserId = "{headers.x-ms-signalr-userid}")] AzureSignalRConnectionInfo info,
244247
ILogger log)
245248
{
246249
log.LogInformation("GetSignalRInfo triggered....");

0 commit comments

Comments
 (0)