Skip to content

Latest commit

 

History

History
60 lines (38 loc) · 4.24 KB

howto-run-microservices-locally.md

File metadata and controls

60 lines (38 loc) · 4.24 KB

Run / Debug Azure Industrial IoT locally

Home

The Industrial IoT Microservices contained in this repository provide a RESTful API exposing the platform capabilities. This article explains how to build, run and debug these services on your local machine.

Prerequisites

Ensure you have deployed the Azure Platform dependencies for all Microservices in this repository and save the resulting .env file. Otherwise, please follow the instructions on how to deploy Azure services only.

If not done yet, clone this GitHub repository. To clone it, you need git. If you don't have git, follow the instructions for Linux, Mac, or Windows to install it.

To clone the repository, open a command prompt or terminal and run:

git clone https://github.com/Azure/Industrial-IoT
cd Industrial-IoT

Build and run the Industrial IoT Microservices with Visual Studio or VS Code

  1. First, make sure your development tool chain is setup to build the Microservices. If not, install .NET Core 3.1+ and
  2. Ensure that the .env file previously generated by the deployment script is located in the repository's root.
  3. Open the Industrial-IoT.sln solution file in Visual Studio or VS Code.
  4. Right-click on the solution in the solution viewer and select Properties.
  5. Set the startup project to be Microsoft.Azure.IIoT.Services.All.
  6. Log into Azure using the Az CLI (az login) or Visual Studio using the credentials used to deploy the infrastructure. See Authenticating to Key vault for more information and troubleshooting.
  7. Start debugging by pressing the "Start" button or hitting F5.
  8. Ensure the Microservices are running.

Installing this extension you can start an entire environment containing Edge modules, command line interface, engineering sample application and services from within Visual Studio 2019. Just select the the "Local development" startup configuration in the top left corner drop down in the IDE. Use the "no services" configuration if you want to start only the edge environment and applications.

Ensure the Microservices are running

After starting open a browser window to:

which will show you the each Microservice's swagger UI. If the services exit immediately after start, check that the .env file exists in the root of the repository.

Authenticating to Key vault

All configuration is stored in Azure Key vault during deployment. Key vault also is used to provide scale out data protection. When running inside Azure Cloud, the platform uses a Managed Service Identity to access the Key vault and pull this information in a secure way. When you run outside of Azure, you need to log in using az login or Visual Studio Service Authentication (Tools -> Options -> Azure Service Authentication).

Double check the following if you encounter any Key vault access issues during startup.

  • If you deployed yourself, make sure that your own user account has Key and Secret access rights to the deployed Key vault.

  • If you did not, or you do not see your user account configured in the Key vault, add your identity and give it all Key and Secret management rights.

  • Sometimes your token has expired. Re-add your account in Visual Studio, or use az login to login again.

Next steps

  • Develop an Application that reads and writes Variables in an OPC UA Server (COMING SOON)