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.
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
- First, make sure your development tool chain is setup to build the Microservices. If not, install .NET Core 3.1+ and
- Visual Studio 2019 16.4+ for Windows, Visual Studio for MacOS 8.3+.
- Or latest version of Visual Studio Code. Ensure you have the [C# for Visual Studio Code (powered by OmniSharp)][omnisharp-url] extension installed.
- Ensure that the
.env
file previously generated by the deployment script is located in the repository's root. - Open the
Industrial-IoT.sln
solution file in Visual Studio or VS Code. - Right-click on the solution in the solution viewer and select
Properties
. - Set the startup project to be
Microsoft.Azure.IIoT.Services.All
. - 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.
- Start debugging by pressing the "Start" button or hitting F5.
- 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.
After starting open a browser window to:
- http://localhost:9080/registry/swagger for OPC Registry Microservice
- http://localhost:9080/twin/swagger for OPC UA Server Twin Microservice
- http://localhost:9080/history/swagger for OPC UA Historic Access Microservice
- http://localhost:9080/publisher/swagger for the OPC Publisher service
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.
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.
- Develop an Application that reads and writes Variables in an OPC UA Server (COMING SOON)