实例介绍
【实例简介】
【实例截图】
【核心代码】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | Table of Contents Preface xiii Chapter 1: Developing Cloud Applications Using Function Triggers and Bindings 1 Introduction 1 Building a backend Web API using HTTP triggers 2 Getting ready 3 How to do it… 3 How it works… 8 See also 8 Persisting employee details using Azure Storage table output bindings 8 Getting ready 9 How to do it... 9 How it works... 13 Understanding storage connection 14 What is the Azure Table storage service? 15 Partition key and row key 15 There's more... 15 Saving the profile images to Queues using Queue output bindings 15 Getting ready 16 How to do it… 16 How it works… 18 Storing the image in Azure Blob Storage 18 Getting ready 18 How to do it... 18 How it works... 20 There's more... 21 Table of Contents [ ii ] Chapter 2: Working with Notifications Using the SendGrid and Twilio Services 23 Introduction 23 Sending an email notification to the administrator of a website using the SendGrid service 24 Getting ready 24 Creating a SendGrid account 24 Generating an API key from the SendGrid portal 27 Configuring the SendGrid API key with the Azure Function app 28 How to do it... 28 Create Storage Queue binding to the HTTP Trigger 29 Create Queue Trigger to process the message of the HTTP Trigger 30 Create SendGrid output binding to the Queue Trigger 31 How it works... 33 There's more 34 Sending an email notification dynamically to the end user 34 Getting ready 34 How to do it... 35 Accept the new email Parameter in the RegisterUser function 35 Retrieve the UserProfile information in the SendNotifications trigger 36 How it works... 37 There's more... 38 Implementing email logging in Azure Blob Storage 39 How to do it... 39 How it works... 41 Modifying the email content to include an attachment 41 Getting ready 42 How to do it... 42 Customizing the log file name using IBinder interface 42 Adding an attachment to the email 43 Sending an SMS notification to the end user using the Twilio service 44 Getting ready 45 How to do it... 47 How it works... 49 Chapter 3: Seamless Integration of Azure Functions with Azure Services 51 Introduction 51 Using Cognitive Services to locate faces in images 52 Getting ready 52 Creating a new Computer Vision API account 52 Configuring application settings 53 Table of Contents [ iii ] How to do it... 53 How it works... 60 There's more... 60 Azure SQL Database interactions using Azure Functions 61 Getting ready 61 How to do it... 63 How it works... 66 Monitoring tweets using Logic Apps and notifying users when a popular user tweets 66 Getting ready 67 How to do it... 67 Creating a new Logic App 67 Designing the Logic App with Twitter and Gmail connectors 69 Testing the Logic App functionality 73 How it works... 74 Integrating Logic Apps with serverless functions 74 How to do it... 75 There's more... 79 See also 80 Auditing Cosmos DB data using change feed triggers 80 Getting ready 80 Creating a new Cosmos DB account 81 Creating a new Cosmos DB collection 81 How to do it... 82 How it works... 86 There's more... 86 Chapter 4: Understanding the Integrated Developer Experience of Visual Studio Tools 87 Introduction 87 Creating a function app using Visual Studio 2017 88 Getting ready 88 How to do it... 90 How it works... 92 There's more... 92 Debugging C# Azure Functions on a local staged environment using Visual Studio 2017 92 Getting ready 93 How to do it... 93 How it works... 97 There's more... 97 Table of Contents [ iv ] Connecting to the Azure Storage cloud from the local Visual Studio environment 98 Getting ready 98 How to do it... 98 How it works... 102 There's more... 102 Deploying the Azure Function app to Azure Cloud using Visual Studio 103 How to do it... 103 There's more... 107 Debugging a live C# Azure Function, hosted on the Microsoft Azure Cloud environment, using Visual Studio 107 Getting ready 108 How to do it... 108 Deploying Azure Functions in a container 111 Getting ready 112 Creating an ACR 113 How to do it... 114 Creating a Docker image for the function app 115 Pushing the Docker image to the ACR 116 Creating a new function app with Docker 118 How it works... 119 Chapter 5: Exploring Tests Tools for the Validation of Azure Functions 121 Introduction 121 Testing Azure Functions 122 Getting ready 122 How to do it... 122 Testing HTTP triggers using Postman 123 Testing a Blob trigger using Microsoft Storage Explorer 125 Testing the Queue trigger using the Azure Management portal 128 There's more... 131 Testing an Azure Function on a staged environment using deployment slots 131 How to do it... 132 There's more... 139 Load testing Azure Functions using Azure DevOps 139 Getting ready 140 How to do it... 140 There's more... 143 See also 144 Table of Contents [ v ] Creating and testing Azure Functions locally using Azure CLI tools 144 Getting ready 144 How to do it... 144 Testing and validating Azure Function responsiveness using Application Insights 147 Getting ready 148 How to do it... 149 How it works... 152 There's more... 152 Developing unit tests for Azure Functions with HTTP triggers 152 Getting ready 153 How to do it... 154 Chapter 6: Monitoring and Troubleshooting Azure Serverless Services 157 Introduction 157 Troubleshooting your Azure Functions 158 How to do it... 158 Viewing real-time application logs 158 Diagnosing the entire function app 160 There's more... 161 Integrating Azure Functions with Application Insights 163 Getting ready 163 How to do it... 164 How it works... 166 There's more... 166 Monitoring your Azure Functions 166 How to do it... 166 How it works... 168 Pushing custom telemetry details to Application Insights Analytics 168 Getting ready 170 How to do it... 170 Creating an Application Insights function 171 Configuring access keys 172 Integrating and testing an Application Insights query 174 Configuring the custom derived metric report 176 How it works... 178 Sending application telemetry details via email 179 Getting ready 179 How to do it... 180 How it works... 182 Table of Contents [ vi ] There's more... 182 See also 182 Integrating real-time Application Insights monitoring data with Power BI using Azure Functions 182 Getting ready 183 How to do it... 184 Configuring Power BI with a dashboard, a dataset, and the push URI 184 Creating an Azure Application Insights real-time Power BI – C# function 190 How it works... 193 There's more... 193 Chapter 7: Developing Reliable Serverless Applications Using Durable Functions 195 Introduction 195 Configuring Durable Functions in the Azure Management portal 196 Getting ready 196 How to do it... 197 There's more... 198 Creating a Durable Function hello world app 199 Getting ready 199 How to do it... 199 Creating an HttpStart function in the Orchestrator client 200 Creating the Orchestrator function 202 Creating an activity function 204 How it works... 205 There's more... 205 Testing and troubleshooting Durable Functions 205 Getting ready 206 How to do it... 206 Implementing multithreaded reliable applications using Durable Functions 208 Getting ready 208 How to do it... 209 Creating the Orchestrator function 209 Creating a GetAllCustomers activity function 210 Creating a CreateBARCodeImagesPerCustomer activity function 211 How it works... 213 There's more... 213 Chapter 8: Bulk Import of Data Using Azure Durable Functions and Cosmos DB 215 Introduction 215 Business problem 216 Table of Contents [ vii ] Durable serverless way of implementing an Excel import 217 Uploading employee data into Blob Storage 217 How to do it... 218 How it works... 221 There’s more... 222 Creating a Blob trigger 222 Getting ready 222 How to do it... 226 There’s more... 226 Creating the Durable Orchestrator and triggering it for each Excel import 227 How to do it... 227 How it works... 230 There’s more... 230 Reading Excel data using activity functions 231 Getting ready 231 How to do it... 232 Read data from Blob Storage 232 Read Excel data from the stream 233 Create the activity function 234 There’s more... 236 Auto-scaling Cosmos DB throughput 237 Getting ready 237 How to do it... 239 There’s more... 241 Bulk inserting data into Cosmos DB 241 How to do it... 241 There’s more... 242 Chapter 9: Implementing Best Practices for Azure Functions 243 Adding multiple messages to a queue using the IAsyncCollector function 244 Getting ready 244 How to do it... 245 How it works... 247 There's more... 247 Implementing defensive applications using Azure Functions and queue triggers 247 Getting ready 248 How to do it... 248 CreateQueueMessage – C# console application 248 Developing the Azure Function – queue trigger 249 Running tests using the console application 250 Table of Contents [ viii ] How it works... 251 There's more... 251 Handling massive ingress using Event Hubs for IoT and other similar scenarios 252 Getting ready 252 How to do it... 252 Creating an Azure Function event hub trigger 252 Developing a console application that simulates IoT data 253 Avoiding cold starts by warming the app at regular intervals 256 Getting ready 256 How to do it... 257 Creating an HTTP trigger 257 Creating a timer trigger 257 There's more... 258 See also 258 Enabling authorization for function apps 258 Getting ready 258 How to do it... 259 How it works... 260 There's more... 260 Controlling access to Azure Functions using function keys 260 How to do it... 261 Configuring the function key for each application 261 Configuring one host key for all the functions in a single function app 262 There's more... 264 Securing Azure Functions using Azure Active Directory 264 Getting ready 265 How to do it... 265 Configuring Azure AD to the function app 265 Registering the client app in Azure AD 266 Granting the client app access to the backend app 269 Testing the authentication functionality using a JWT token 269 Configuring throttling of Azure Functions using API Management 271 Getting ready 272 How to do it... 273 Integrating Azure Functions with API Management 273 Configuring request throttling using inbound policies 276 Testing the rate limit inbound policy configuration 278 How it works... 279 Securely accessing SQL Database from Azure Functions using Managed Service Identity 280 Getting ready 280 Table of Contents [ ix ] How to do it... 281 Creating a function app using Visual Studio 2017 with V1 runtime 281 Creating a Logical SQL Server and a SQL Database 284 Enabling the managed service identity 284 There's more... 287 See also 287 Shared code across Azure Functions using class libraries 287 How to do it... 288 How it works... 290 There's more... 291 Using strongly typed classes in Azure Functions 291 Getting ready 291 How to do it... 292 How it works... 294 There's more... 294 Chapter 10: Configuring of Serverless Applications in the Production Environment 295 Introduction 295 Deploying Azure Functions using the Run From Package 296 Getting ready 297 How to do it... 298 How it works... 299 There's more... 299 Deploying Azure Function using ARM templates 299 Getting ready 299 How to do it... 300 There's more... 303 Configuring custom domain to Azure Functions 303 Getting ready 304 How to do it... 304 Configuring function app with an existing domain 306 Techniques to access Application Settings 308 Getting ready 308 How to do it... 308 Accessing Application Settings and connection strings in the Azure Function code 308 Application setting – binding expressions 311 Creating and generating open API specifications using Swagger 311 Getting ready 312 How to do it... 312 Table of Contents [ x ] Breaking down large APIs into small subsets of APIs using proxies 316 Getting ready 316 How to do it... 317 Creating microservices 318 Creating the gateway proxies 318 Testing the proxy URLs 321 There's more... 321 See also 322 Moving configuration items from one environment to another using resources 322 Getting ready 323 How to do it... 324 Chapter 11: Implementing and Deploying Continuous Integration Using Azure DevOps 329 Introduction 329 Prerequisites 330 Continuous integration – creating a build definition 331 Getting ready 332 How to do it... 333 How it works... 337 There's more... 338 Continuous integration – queuing a build and triggering it manually 338 Getting ready 338 How to do it... 339 Configuring and triggering an automated build 341 How to do it... 342 How it works... 344 There's more... 344 Continuous integration – executing unit test cases in the pipeline 345 How to do it.. 346 There's more... 348 Creating a release definition 348 Getting ready 349 How to do it... 350 How it works... 358 There's more... 358 See also 359 Table of Contents [ xi ] Triggering the release automatically 360 Getting ready 360 How to do it... 360 How it works... 362 There's more... 362 Other Books You May Enjoy 363 Index 367 |
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论