• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created about 6 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sample OPC UA server with nodes that generate random and increasing data, anomalies and much more ...
page_type description languages products urlFragment
sample
Industrial IoT - Sample OPC UA server that generates random data and anomalies.
csharp
azure
azure-iot-hub
azure-iot-sample-opc-ua-server

OPC PLC server

Implements an OPC-UA server with different nodes generating random data, anomalies and configuration of user defined nodes.

Deploy to Azure

  • After deployment, the OPC PLC server will be available at opc.tcp://<NAME>.<REGION>.azurecontainer.io:50000
  • See region limits

Features

The following nodes are part of the PLC simulation:

  • Alternating boolean
  • Random signed 32-bit integer
  • Random unsigned 32-bit integer
  • Sine wave with a spike anomaly
  • Sine wave with a dip anomaly
  • Value showing a positive trend
  • Value showing a negative trend
  • Value having periodical good, bad and uncertain statuses (slow changing - 10 s by default)
  • Value having periodical good, bad and uncertain statuses (fast changing - 1 s by default)

By default everything is enabled, use command line options to disable certain anomaly or data generation features. Additionally to those nodes with simulated data, a JSON configuration file allows nodes to be created as specified. Finally, the simulation supports a number of nodes of specific types that can change at a configurable rate.

Getting Started

Prerequisites

The implementation is based on .NET Core so it is cross-platform. The recommended hosting environment is Docker.

Quickstart

A Docker container of the component is hosted in the Microsoft Container Registry (MCR) and can be pulled by:

docker pull mcr.microsoft.com/iotedge/opc-plc:<See version.json>

The tags of the container match the tags of this repository and the containers are available for Windows and Linux.

Sample start command for Docker:

docker run --rm -it -p 50000:50000 -p 8080:8080 --name opcplc mcr.microsoft.com/iotedge/opc-plc:latest --pn=50000 --autoaccept --sph --sn=5 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint --gn=5

Sample start command for Windows:

dotnet opcplc.dll --pn=50000 --at X509Store --autoaccept --sph --sn=5 --sr=10 --st=uint --fn=5 --fr=1 --ft=uint --gn=5

Note: Make sure that your OPC UA client uses security policy Basic256Sha256 and message security mode Sign & Encrypt to connect.

User node configuration via JSON configuration file

If the module (application) is started with the argument --nodesfile then the specified JSON configuration file is loaded. Nodes defined in the JSON file will be published by the server. This enables another OPC-UA client application to set the state/value of the node. Please note that nodes specified in the JSON file are NOT part of the simulation. They remain visible in an unchanged state until an OPC UA client changes their status.

The following command shows how to use a configuration file on Windows:

dotnet opcplc.dll --at X509Store --nodesfile nodesfile.json

Here's a sample node configuration file:

{
  "Folder": "MyTelemetry",
  "FolderList": [
    {
      "Folder": "Directory",
      "NodeList": [
        {
          "NodeId": "ChildNode"
        },
      ]
    }
  ],
  "NodeList": [
    {
      "NodeId": 1023,
      "Name": "ActualSpeed",
      "Description": "Rotational speed"
    },
    {
      "NodeId": "aRMS"
    },
    {
      "NodeId": "1025",
      "Name": "DKW",
      "DataType": "Float",
      "ValueRank": -1,
      "AccessLevel": "CurrentReadOrWrite",
      "Description": "Diagnostic characteristic value"
    }
  ]
}
  • Folder: Defines the name of the folder under which the user specified nodes should be created. This folder is created below the root of the OPC UA server.
  • FolderList: Defines the list of child folders, which will be published by the emulated server. (Optional)
  • NodeList: Defines the list of nodes, which will be published by the emulated server. Nodes specified in the list can be browsed and changed by OPC UA applications. This enables developers to easily implement and test OPC UA client applications.
  • NodeId: Specifies the identifier of the node and is required. This value can be a decimal or string value. Every other JSON type is converted to a string identifier.
  • Name: The display name of the tag. If not set it will be set to the NodeId. (Optional)
  • DataType: The OPC UA valid type. It specifies one of types defined by BuiltInType. If an invalid type is specified or if it is omitted it defaults to 'Int32'. (Optional)
  • ValueRank: As defined by type ValueRanks. If omitted it will be set to the value '-1' (Scalar). (Optional)
  • AccessLevel: Specifies one of access levels defined by type AccessLevels. If an invalid access level is specified or if it is omitted it defaults to 'CurrentReadOrWrite'. (Optional)
  • Description: Description of the node. If not set it will be set to the NodeId. (Optional)

Slow and fast changing nodes

A number of changing nodes can be simulated with the following options. The nodes are categorized into slow and fast only for convenience.

  • sn: Number of slow nodes (default 1)
  • sr: Rate in seconds at which to change the slow nodes (uint, default every 10 s)
  • st: Data type for slow nodes (UInt|Double|Bool|UIntArray, case insensitive)
  • stl: lower bound of data type of slow nodes (UInt|Double types only, defaults to minimium value of the type in C# with exception of Double where it defaults to 0.0)
  • stu: upper bound of data type of slow nodes (UInt|Double types only, defaults to maximum value of the type in C#)
  • str: randomization of slow nodes value (UInt|Double types only, defaults to false)
  • sts: step or increment size of slow nodes value (UInt|Double types only, defaults to 1)
  • fn: Number of fast nodes (default 1)
  • fr: Rate in seconds at which to change the fast nodes (uint, default every 1 s)
  • vfr: Rate in milliseconds at which to change the fast nodes (uint, default every 1000 ms)
  • ft: Data type for fast nodes (UInt|Double|Bool|UIntArray, case insensitive)
  • ftl: lower bound of data type of fast nodes (UInt|Double types only, defaults to minimium value of the type in C# with exception of Double where it defaults to 0.0)
  • ftu: upper bound of data type of fast nodes (UInt|Double types only, defaults to maximum value of the type in C#)
  • ftr: randomization of fast nodes value (UInt|Double types only, defaults to false)
  • fts: step or increment size of fast nodes value (UInt|Double types only, defaults to 1)

Data types

  • UInt: Increases by 1
  • Double: Increases by 0.1
  • Bool: Alternates
  • UIntArray: 32 values that increase by 1

OPC Publisher file (pn.json)

The options --sph and --sp show and dump an OPC Publisher configuration file (default name: pn.json) that matches the configuration. In addition, a web server hosts the file on a configurable port (--wp, default 8080): e.g. http://localhost:8080/pn.json Additionally, you can set the configuration file name via the option --spf.

Complex type (Boiler #1)

Adds a simple boiler to the address space.

Features:

  • BoilerStatus is a complex type that shows: Temperature, Pressure and HeaterState
  • Method to turn heater on/off
  • When the heater is on, the bottom temperature increases by 1 degree/s, the top temperature is always 5 degrees less than the bottom one
  • Pressure is calculated as 100000 + bottom temperature

Boiler #2 derived from the Device Information (DI) companion spec

Adds a configurable boiler that exposes DI properties such as AssetId (ITagNameplate, IVendorNameplate) and DeviceHealth.

Features:

  • Configure and expose: BaseTemperature, TargetTemperature, TemperatureChangeSpeed, CurrentTemperature, HeaterState, Overheated, OverheatThresholdTemperature
  • Method to switch heater on/off
  • The MaintenanceInterval and OverheatInterval both emit events

Simulation details:

  • When the heater is off, the CurrentTemperature falls to the BaseTemperature and the heater is switched on
  • When the heater is on, the CurrentTemperature raises to the TargetTemperature and the heater is switched off
  • Emits a "MaintenanceRequiredAlarmType" event when DeviceHealth is MAINTENANCE_REQUIRED
  • The OverheatInterval increases the temperature to 10 degrees above the OverheatThresholdTemperature, the heater is switched off and:
    • Emits a "CheckFunctionAlarmType" event when DeviceHealth is CHECK_FUNCTION
    • Emits a "FailureAlarmType" event when DeviceHealth is FAILURE
    • Emits an "OffSpecAlarmType" event when DeviceHealth is OFF_SPEC

DeviceHealth (DeviceHealthEnumeration) details:

  • NORMAL: BaseTemperature <= CurrentTemperature <= TargetTemperature
  • CHECK_FUNCTION: TargetTemperature < CurrentTemperature < OverheatThresholdTemperature
  • FAILURE: Temperature >= OverheatThresholdTemperature
  • OFF_SPEC: CurrentTemperature < BaseTemperature or CurrentTemperature > OverheatThresholdTemperature + 5
  • MAINTENANCE_REQUIRED: Triggered by MaintenanceInterval
Temperature DeviceHealth
< BaseTemperature OFF_SPEC
>= BaseTemperature NORMAL
<= TargetTemperature NORMAL
> TargetTemperature CHECK_FUNCTION
>= OverheatThresholdTemperature FAILURE
> OverheatThresholdTemperature + 5 OFF_SPEC

Simple Events

The option --ses enables simple events from the quickstart sample from OPC Foundation.

Simple Events defines four new event types. SystemCycleStatusEventType is inherited from the SystemEventType and SystemCycleStartedEventType, SystemCycleAbortedEventType, SystemCycleFinishedEventType from SystemCycleStatusEventType.

Every 3000 ms a new SystemCycleStartedEventState is triggered. (The other event types are not used.) Two messages are generated with a counter "The system cycle '{counter}' has started." for each event, one has severity 1 and the other one severity 2.

A structure of type CycleStepDataType is added to SystemCycleStartedEventState event. The values in that structure is hard coded to Name: Step 1 and Duration: 1000.

Alarms and Condition

The option --alm enables Alarm and Condition quickstart sample from OPC Foundation.

It creates a hierarchical folder structure from Server, starting with Green and Yellow. The leaf nodes SouthMotor, WestTank, EastTank and NorthMotor are sources for the alarms.

The alarms are of different types:

All these alarms will update on a regular interval. It is also possible to Acknowledge, Confirm and add Comment to them.

This simulation also emits two types of system events: SystemEventType and AuditEventType, every 1000 ms.

Deterministic Alarms testing

The option --dalm=<file> enables deterministic testing of Alarms and Conditions.

More information about this feature can be found here.

Other features

  • Node with special characters in name and NodeId:
  • Node with long ID (3950 bytes)
  • Nodes with large values (10/50 kB string, 100 kB StringArray, 200 kB ByteArray)
  • Nodes for testing all datatypes, arrays, methods, permissions, etc. The ReferenceNodeManager of the OPC UA .NET reference stack is used for this purpose.
  • Limit the number of updates of Slow and Fast nodes. Update the values of the SlowNumberOfUpdates and FastNumberOfUpdates configuration nodes in the OpcPlc/SimulatorConfiguration folder to:
    • < 0 (default): Slow and Fast nodes are updated indefinitely
    • 0: Slow and Fast nodes are not updated
    • > 0: Slow and Fast nodes are updated the given number of times, then they stop being updated (the value of the configuration node is decremented at every update).
  • Nodes with deterministic random GUIDs as node IDs: --gn=<number_of_nodes>
  • Node with opaque identifier (free-format byte string)
  • Load binary *.PredefinedNodes.uanodes file(s) compiled from an XML NodeSet: --unf=<PredefinedNodes_uanodes>
  • Load *.NodeSet2.xml file(s): --ns2=<NodeSet2_xml>

OPC UA Methods

Name Description Prerequisite
ResetTrend Reset the trend values to their baseline value Generate positive or negative trends activated
ResetStepUp Resets the StepUp counter to 0 Generate data activated
StopStepUp Stops the StepUp counter Generate data activated
StartStepUp Starts the StepUp counter Generate data activated
StopUpdateSlowNodes Stops the increase of value of slow nodes slow nodes activated
StopUpdateFastNodes Stops the increase of value of fast nodes fast nodes activated
StartUpdateSlowNodes Start the increase of value of slow nodes slow nodes activated
StartUpdateFastNodes Start the increase of value of fast nodes fast nodes activated

Build

The build scripts are for Azure DevOps and the container build is done in ACR. To use your own ACR you need to:

  • Create a service connection called azureiiot to the subscription/resource group in which your ACR is located
  • Set a variable called BUILD_REGISTRY with the name of your Azure Container Registry

Using <reporoot>/tools/scripts/build.ps1 you can also build with Docker Desktop locally. The sample below builds a debug container and is started at the root of the repository:

.\tools\scripts\build.ps1 -Path . -Debug

If you want to build using Docker yourself, it is a bit more complicated, since the dockerfile is generated by the scripts. So first run the build.ps1 script as above, then locate the dockerfile for your configuration and target runtime under <reporoot>/src/bin/publish. Next, make your modifications and publish the opc-plc project in Visual Studio. Ensure that you have chosen "Self-Contained" as "Deployment Mode" and the correct "Target runtime" in the Visual Studio Publish configuration. Finally, run the docker build command in the folder you published to using the dockerfile of your configuration and target runtime.

Building with PowerShell is even simpler. Here's an example for a linux-x64 build:

.\tools\scripts\docker-source.ps1 .\src
docker build -f .\src\bin\publish\Release\linux-x64\Dockerfile.linux-amd64 -t iotedge/opc-plc .\src\bin\publish\Release\linux-x64

Notes

X.509 certificates:

  • Running on Windows natively, you cannot use an application certificate store of type Directory, since the access to the private key will fail. Use the option --at X509Store in this case.
  • Running as Linux Docker container, you can map the certificate stores to the host file system by using the Docker run option -v <hostpkidirectory>:/app/pki. This will make the certificate persistent over starts.
  • Running as Linux Docker container using an X509Store for the application certificate, you need to use the Docker run option -v x509certstores:/root/.dotnet/corefx/cryptography/x509stores and the application option --at X509Store

Resources

Command-line reference

Usage: dotnet opcplc.dll [<options>]

OPC UA PLC for different data simulation scenarios.
To exit the application, press CTRL-C while it's running.

Use the following format to specify a list of strings:
"<string 1>,<string 2>,...,<string n>"
or if one string contains commas:
""<string 1>","<string 2>",...,"<string n>""

Options:
      --lf, --logfile=VALUE  the filename of the logfile to use.
                               Default: './hostname-plc.log'
      --lt, --logflushtimespan=VALUE
                             the timespan in seconds when the logfile should be
                               flushed.
                               Default: 00:00:30 sec
      --ll, --loglevel=VALUE the loglevel to use (allowed: fatal, error, warn,
                               info, debug, verbose).
                               Default: info
      --sc, --simulationcyclecount=VALUE
                             count of cycles in one simulation phase
                               Default:  50 cycles
      --ct, --cycletime=VALUE
                             length of one cycle time in milliseconds
                               Default:  100 msec
      --ei, --eventinstances=VALUE
                             number of event instances
                               Default: 0
      --er, --eventrate=VALUE
                             rate in milliseconds to send events
                               Default: 1000
      --pn, --portnum=VALUE  the server port of the OPC server endpoint.
                               Default: 50000
      --op, --path=VALUE     the enpoint URL path part of the OPC server
                               endpoint.
                               Default: ''
      --ph, --plchostname=VALUE
                             the fully-qualified hostname of the PLC.
                               Default: hostname
      --ol, --opcmaxstringlen=VALUE
                             the max length of a string OPC can transmit/
                               receive.
                               Default: 4194304
      --lr, --ldsreginterval=VALUE
                             the LDS(-ME) registration interval in ms. If 0,
                               then the registration is disabled.
                               Default: 0
      --aa, --autoaccept     all certs are trusted when a connection is
                               established.
                               Default: False
      --drurs, --dontrejectunknownrevocationstatus
                             Don't reject chain validation with CA certs with
                               unknown revocation status, e.g. when the CRL is
                               not available or the OCSP provider is offline.
                               Default: False
      --ut, --unsecuretransport
                             enables the unsecured transport.
                               Default: False
      --to, --trustowncert   the own certificate is put into the trusted
                               certificate store automatically.
                               Default: False
      --msec, --maxsessioncount
                             maximum number of parallel sessions.
                               Default: 100
      --msuc, --maxsubscriptioncount
                             maximum number of subscriptions.
                               Default: 100
      --mqrc, --maxqueuedrequestcount
                             maximum number of requests that will be queued waiting for a thread.
                               Default: 2000
      --at, --appcertstoretype=VALUE
                             the own application cert store type.
                               (allowed values: Directory, X509Store)
                               Default: 'Directory'
      --ap, --appcertstorepath=VALUE
                             the path where the own application cert should be
                               stored
                               Default (depends on store type):
                               X509Store: 'CurrentUser\UA_MachineDefault'
                               Directory: 'pki\own'
      --tp, --trustedcertstorepath=VALUE
                             the path of the trusted cert store
                               Default 'pki\trusted'
      --rp, --rejectedcertstorepath=VALUE
                             the path of the rejected cert store
                               Default 'pki\rejected'
      --ip, --issuercertstorepath=VALUE
                             the path of the trusted issuer cert store
                               Default 'pki\issuer'
      --csr                  show data to create a certificate signing request
                               Default 'False'
      --ab, --applicationcertbase64=VALUE
                             update/set this application's certificate with the
                               certificate passed in as bas64 string
      --af, --applicationcertfile=VALUE
                             update/set this application's certificate with the
                               certificate file specified
      --pb, --privatekeybase64=VALUE
                             initial provisioning of the application
                               certificate (with a PEM or PFX fomat) requires a
                               private key passed in as base64 string
      --pk, --privatekeyfile=VALUE
                             initial provisioning of the application
                               certificate (with a PEM or PFX fomat) requires a
                               private key passed in as file
      --cp, --certpassword=VALUE
                             the optional password for the PEM or PFX or the
                               installed application certificate
      --tb, --addtrustedcertbase64=VALUE
                             adds the certificate to the application's trusted
                               cert store passed in as base64 string (comma
                               separated values)
      --tf, --addtrustedcertfile=VALUE
                             adds the certificate file(s) to the application's
                               trusted cert store passed in as base64 string (
                               multiple comma separated filenames supported)
      --ib, --addissuercertbase64=VALUE
                             adds the specified issuer certificate to the
                               application's trusted issuer cert store passed
                               in as base64 string (comma separated values)
      --if, --addissuercertfile=VALUE
                             adds the specified issuer certificate file(s) to
                               the application's trusted issuer cert store (
                               multiple comma separated filenames supported)
      --rb, --updatecrlbase64=VALUE
                             update the CRL passed in as base64 string to the
                               corresponding cert store (trusted or trusted
                               issuer)
      --uc, --updatecrlfile=VALUE
                             update the CRL passed in as file to the
                               corresponding cert store (trusted or trusted
                               issuer)
      --rc, --removecert=VALUE
                             remove cert(s) with the given thumbprint(s) (comma
                               separated values)
      --daa, --disableanonymousauth
                             flag to disable anonymous authentication.
                               Default: False
      --dua, --disableusernamepasswordauth
                             flag to disable username/password authentication.
                               Default: False
      --dca, --disablecertauth
                             flag to disable certificate authentication.
                               Default: False
      --au, --adminuser=VALUE
                             the username of the admin user.
                               Default: sysadmin
      --ac, --adminpassword=VALUE
                             the password of the administrator.
                               Default: demo
      --du, --defaultuser=VALUE
                             the username of the default user.
                               Default: user1
      --dc, --defaultpassword=VALUE
                             the password of the default user.
                               Default: password
      --alm, --alarms        add alarm simulation to address space.
                               Default: False
      --ses, --simpleevents  add simple events simulation to address space.
                               Default: False
      --dalm, --deterministicalarms=VALUE
                             add deterministic alarm simulation to address
                               space.
                               Provide a script file for controlling
                               deterministic alarms.
      --sp, --showpnjson     show OPC Publisher configuration file using IP
                               address as EndpointUrl.
                               Default: False
      --sph, --showpnjsonph  show OPC Publisher configuration file using
                               plchostname as EndpointUrl.
                               Default: False
      --spf, --showpnfname=VALUE
                             filename of the OPC Publisher configuration file
                               to write when using options sp/sph.
                               Default: pn.json
      --wp, --webport=VALUE  web server port for hosting OPC Publisher
                               configuration file.
                               Default: 8080
      --cdn, --certdnsnames=VALUE
                             add additional DNS names or IP addresses to this
                               application's certificate (comma separated
                               values; no spaces allowed)
                               Default: DNS hostname
  -h, --help                 show this message and exit
      --b2ts, --boiler2tempspeed=VALUE
                             Boiler #2 temperature change speed in degrees per
                               second
                               Default: 1
      --b2bt, --boiler2basetemp=VALUE
                             Boiler #2 base temperature to reach when not
                               heating
                               Default: 10
      --b2tt, --boiler2targettemp=VALUE
                             Boiler #2 target temperature to reach when heating
                               Default: 80
      --b2mi, --boiler2maintinterval=VALUE
                             Boiler #2 required maintenance interval in seconds
                               Default: 300
      --b2oi, --boiler2overheatinterval=VALUE
                             Boiler #2 overheat interval in seconds
                               Default: 120
      --nv, --nodatavalues   do not generate data values
                               Default: False
      --gn, --guidnodes=VALUE
                             number of nodes with deterministic GUID IDs
                               Default: 1
      --nd, --nodips         do not generate dip data
                               Default: False
      --fn, --fastnodes=VALUE
                             number of fast nodes
                               Default: 1
      --fr, --fastrate=VALUE rate in seconds to change fast nodes
                               Default: 1
      --ft, --fasttype=VALUE data type of fast nodes (UInt|Double|Bool|
                               UIntArray)
                               Default: UInt
      --ftl, --fasttypelowerbound=VALUE
                             lower bound of data type of fast nodes (UInt|
                               Double|Bool|UIntArray)
                               Default: min value of node type.
      --ftu, --fasttypeupperbound=VALUE
                             upper bound of data type of fast nodes (UInt|
                               Double|Bool|UIntArray)
                               Default: max value of node type.
      --ftr, --fasttyperandomization=VALUE
                             randomization of fast nodes value (UInt|Double|
                               Bool|UIntArray)
                               Default: False
      --fts, --fasttypestepsize=VALUE
                             step or increment size of fast nodes value (UInt|
                               Double|Bool|UIntArray)
                               Default: 1
      --fsi, --fastnodesamplinginterval=VALUE
                             rate in milliseconds to sample fast nodes
                               Default: 0
      --vfr, --veryfastrate=VALUE
                             rate in milliseconds to change fast nodes
                               Default: 1000
      --nn, --nonegtrend     do not generate negative trend data
                               Default: False
      --ns2, --nodeset2file=VALUE
                             the *.NodeSet2.xml file that contains the nodes to
                               be created in the OPC UA address space (multiple
                               comma separated filenames supported)
      --np, --nopostrend     do not generate positive trend data
                               Default: False
      --sn, --slownodes=VALUE
                             number of slow nodes
                               Default: 1
      --sr, --slowrate=VALUE rate in seconds to change slow nodes
                               Default: 10
      --st, --slowtype=VALUE data type of slow nodes (UInt|Double|Bool|
                               UIntArray)
                               Default: UInt
      --stl, --slowtypelowerbound=VALUE
                             lower bound of data type of slow nodes (UInt|
                               Double|Bool|UIntArray)
                               Default: min value of node type.
      --stu, --slowtypeupperbound=VALUE
                             upper bound of data type of slow nodes (UInt|
                               Double|Bool|UIntArray)
                               Default: max value of node type.
      --str, --slowtyperandomization=VALUE
                             randomization of slow nodes value (UInt|Double|
                               Bool|UIntArray)
                               Default: False
      --sts, --slowtypestepsize=VALUE
                             step or increment size of slow nodes value (UInt|
                               Double|Bool|UIntArray)
                               Default: 1
      --ssi, --slownodesamplinginterval=VALUE
                             rate in milliseconds to sample slow nodes
                               Default: 0
      --ns, --nospikes       do not generate spike data
                               Default: False
      --unf, --uanodesfile=VALUE
                             the binary *.PredefinedNodes.uanodes file that
                               contains the nodes to be created in the OPC UA
                               address space (multiple comma separated
                               filenames supported), use ModelCompiler.cmd <
                               ModelDesign> to compile
      --nf, --nodesfile=VALUE
                             the filename that contains the list of nodes to be
                               created in the OPC UA address space

More Repositories

1

azure-search-openai-demo

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
Python
5,707
star
2

cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
C#
1,955
star
3

graphrag-accelerator

One-click deploy of a Knowledge Graph powered RAG (GraphRAG) in Azure
Python
1,730
star
4

active-directory-aspnetcore-webapp-openidconnect-v2

An ASP.NET Core Web App which lets sign-in users (including in your org, many orgs, orgs + personal accounts, sovereign clouds) and call Web APIs (including Microsoft Graph)
PowerShell
1,366
star
5

openai

The repository for all Azure OpenAI Samples complementing the OpenAI cookbook.
Jupyter Notebook
1,090
star
6

contoso-real-estate

Intelligent enterprise-grade reference architecture for JavaScript, featuring OpenAI integration, Azure Developer CLI template and Playwright tests.
JavaScript
881
star
7

Cognitive-Speech-TTS

Microsoft Text-to-Speech API sample code in several languages, part of Cognitive Services.
C#
870
star
8

chat-with-your-data-solution-accelerator

A Solution Accelerator for the RAG pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences. This includes most common requirements and best practices.
Python
816
star
9

blockchain

Azure Blockchain Content and Samples
HTML
786
star
10

serverless-chat-langchainjs

Build your own serverless AI Chat with Retrieval-Augmented-Generation using LangChain.js, TypeScript and Azure
Bicep
694
star
11

azure-search-openai-demo-csharp

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure Cognitive Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
C#
638
star
12

Serverless-microservices-reference-architecture

This reference architecture walks you through the decision-making process involved in designing, developing, and delivering a serverless application using a microservices architecture through hands-on instructions for configuring and deploying all of the architecture's components along the way. The goal is to provide practical hands-on experience in working with several Azure services and the technologies that effectively use them in a cohesive and unified way to build a serverless-based microservices architecture.
C#
493
star
13

modern-data-warehouse-dataops

DataOps for the Modern Data Warehouse on Microsoft Azure. https://aka.ms/mdw-dataops.
Shell
486
star
14

openai-plugin-fastapi

A simple ChatGPT Plugin running in Codespaces for dev and Azure for production.
Bicep
432
star
15

Azure-MachineLearning-DataScience

HTML
407
star
16

raspberry-pi-web-simulator

Raspberry Pi web simulator. Demo address:
JavaScript
406
star
17

contoso-chat

This sample has the full End2End process of creating RAG application with Prompt Flow and AI Studio. It includes GPT 3.5 Turbo LLM application code, evaluations, deployment automation with AZD CLI, GitHub actions for evaluation and deployment and intent mapping for multiple LLM task mapping.
Jupyter Notebook
400
star
18

MyDriving

Building IoT or Mobile solutions are fun and exciting. This year for Build, we wanted to show the amazing scenarios that can come together when these two are combined. So, we went and developed a sample application. MyDriving uses a wide range of Azure services to process and analyze car telemetry data for both real-time insights and long-term patterns and trends. The following features are supported in the current version of the mobile app.
C#
387
star
19

azure-voting-app-redis

Azure voting app used in docs.
Shell
370
star
20

azure-search-knowledge-mining

Azure Search Knowledge Mining Accelerator
CSS
370
star
21

azure-cli-samples

Contains Azure CLI scripts samples used for documentation at https://docs.microsoft.com
Shell
353
star
22

Synapse

Samples for Azure Synapse Analytics
Jupyter Notebook
348
star
23

nodejs-docs-hello-world

A simple nodejs application for docs
JavaScript
347
star
24

cognitive-services-quickstart-code

Code Examples used by the Quickstarts in the Cognitive Services Documentation
Jupyter Notebook
346
star
25

saga-orchestration-serverless

An orchestration-based saga implementation reference in a serverless architecture
C#
340
star
26

container-apps-store-api-microservice

Sample microservices solution using Azure Container Apps, Dapr, Cosmos DB, and Azure API Management
Shell
323
star
27

azure-sdk-for-go-samples

Examples of how to utilize Azure services from Go.
Go
296
star
28

AzureMapsCodeSamples

A set of code samples for the Azure Maps web control.
JavaScript
293
star
29

active-directory-dotnet-native-aspnetcore-v2

Calling a ASP.NET Core Web API from a WPF application using Azure AD v2.0
C#
280
star
30

jp-azureopenai-samples

Python
270
star
31

active-directory-b2c-custom-policy-starterpack

Azure AD B2C now allows uploading of a Custom Policy which allows full control and customization of the Identity Experience Framework
268
star
32

azureai-samples

Official community-driven Azure AI Examples
Jupyter Notebook
260
star
33

azure-batch-samples

Azure Batch and HPC Code Samples
C#
256
star
34

active-directory-b2c-dotnet-webapp-and-webapi

A combined sample for a .NET web application that calls a .NET web API, both secured using Azure AD B2C
JavaScript
244
star
35

openai-dotnet-samples

Azure OpenAI .NET Samples
Jupyter Notebook
236
star
36

streaming-at-scale

How to implement a streaming at scale solution in Azure
C#
234
star
37

azure-files-samples

This repository contains supporting code (PowerShell modules/scripts, ARM templates, etc.) for deploying, configuring, and using Azure Files.
PowerShell
231
star
38

azure-search-openai-javascript

A TypeScript sample app for the Retrieval Augmented Generation pattern running on Azure, using Azure AI Search for retrieval and Azure OpenAI and LangChain large language models (LLMs) to power ChatGPT-style and Q&A experiences.
TypeScript
231
star
39

service-fabric-dotnet-getting-started

Get started with Service Fabric with these simple introductory sample projects.
CSS
230
star
40

ansible-playbooks

Ansible Playbook Samples for Azure
226
star
41

cognitive-services-REST-api-samples

This is a repo for cognitive services REST API samples in 4 languages: C#, Java, Node.js, and Python.
HTML
217
star
42

active-directory-dotnetcore-daemon-v2

A .NET Core daemon console application calling Microsoft Graph or your own WebAPI with its own identity
PowerShell
215
star
43

active-directory-b2c-advanced-policies

Sample for use with Azure AD B2C with Custom Policies.
C#
215
star
44

powerbi-powershell

Samples for calling the Power BI REST API via PowerShell
PowerShell
207
star
45

ms-identity-python-webapp

A Python web application calling Microsoft graph that is secured using the Microsoft identity platform
PowerShell
207
star
46

ms-identity-javascript-react-tutorial

A chapterwise tutorial that will take you through the fundamentals of modern authentication with Microsoft identity platform in React using MSAL React
JavaScript
204
star
47

SpeechToText-WebSockets-Javascript

SDK & Sample to do speech recognition using websockets in Javascript
TypeScript
200
star
48

azure-iot-samples-csharp

Provides a set of easy-to-understand samples for using Azure IoT Hub and Azure IoT Hub Device Provisioning Service and Azure IoT Plug and Play using C# SDK.
C#
196
star
49

digital-twins-explorer

A code sample for visualizing Azure Digital Twins graphs as a web application to create, edit, view, and diagnose digital twins, models, and relationships.
JavaScript
184
star
50

AI-Gateway

APIM ❤️ OpenAI - this repo contains a set of experiments on using GenAI capabilities of Azure API Management with Azure OpenAI and other services
Jupyter Notebook
182
star
51

Serverless-Eventing-Platform-for-Microservices

This solution is a personal knowledge management system and it allows users to upload text, images, and audio into categories. Each of these types of data is managed by a dedicated microservice built on Azure serverless technologies including Azure Functions and Cognitive Services. The web front-end communicates with the microservices through a SignalR-to-Event Grid bridge, allowing for real-time reactive UI updates based on the microservice updates. Each microservice is built and deployed independently using VSTS’s build and release management system, and use a variety of Azure-native data storage technologies.
C#
176
star
52

Custom-vision-service-iot-edge-raspberry-pi

Sample showing how to deploy a AI model from the Custom Vision service to a Raspberry Pi 3 device using Azure IoT Edge
Python
176
star
53

active-directory-angularjs-singlepageapp

An AngularJS based single page app, implemented with an ASP.NET Web API backend, that signs in users and calls web APIs using Azure AD
JavaScript
171
star
54

IoTDemos

Demos created by the IoT Engineering team that showcase IoT services in an end-to-end solution
CSS
171
star
55

ms-identity-aspnet-webapp-openidconnect

A sample showcasing how to develop a web application that handles sign on via the unified Azure AD and MSA endpoint, so that users can sign in using both their work/school account or Microsoft account. The sample also shows how to use MSAL to obtain a token for invoking the Microsoft Graph, as well as incrementental consent.
170
star
56

cosmos-db-design-patterns

A collection of design pattern samples for building applications and services with Azure Cosmos DB for NoSQL.
C#
167
star
57

ms-identity-javascript-angular-tutorial

A chapterwise tutorial that will take you through the fundamentals of modern authentication with Microsoft identity platform in Angular using MSAL Angular v2
TypeScript
165
star
58

azure-python-labs

Labs demonstrating how to use Python with Azure, Visual Studio Code, GitHub, Windows Subsystem for Linux, and more!
Python
164
star
59

active-directory-b2c-javascript-msal-singlepageapp

A single page application (SPA) calling a Web API. Authentication is done with Azure AD B2C by leveraging MSAL.js
JavaScript
164
star
60

cosmosdb-chatgpt

Sample application that combines Azure Cosmos DB with Azure OpenAI ChatGPT service
HTML
163
star
61

active-directory-b2c-dotnetcore-webapp

An ASP.NET Core web application that can sign in a user using Azure AD B2C, get an access token using MSAL.NET and call an API.
C#
160
star
62

active-directory-xamarin-native-v2

This is a simple Xamarin Forms app showcasing how to use MSAL.NET to authenticate work or school and Microsoft personal accounts with the Microsoft identity platform, and access the Microsoft Graph with the resulting token.
C#
160
star
63

cognitive-services-python-sdk-samples

Learn how to use the Cognitive Services Python SDK with these samples
Python
159
star
64

active-directory-dotnet-webapp-openidconnect

A .NET MVC web application that uses OpenID Connect to sign-in users from a single Azure Active Directory tenant.
JavaScript
159
star
65

NVIDIA-Deepstream-Azure-IoT-Edge-on-a-NVIDIA-Jetson-Nano

This is a sample showing how to do real-time video analytics with NVIDIA DeepStream connected to Azure via Azure IoT Edge. It uses a NVIDIA Jetson Nano device that can process up to 8 real-time video streams concurrently.
C++
158
star
66

openhack-devops-team

DevOps OpenHack Team environment APIs
C#
153
star
67

semantic-kernel-rag-chat

Tutorial for ChatGPT + Enterprise Data with Semantic Kernel, OpenAI, and Azure Cognitive Search
C#
147
star
68

azure-search-power-skills

A collection of useful functions to be deployed as custom skills for Azure Cognitive Search
C#
146
star
69

azure-spring-boot-samples

Spring Cloud Azure Samples
JavaScript
146
star
70

service-fabric-dotnet-web-reference-app

An end-to-end Service Fabric application that demonstrates patterns and features in a web application scenario.
C#
144
star
71

aks-store-demo

Sample microservices app for AKS demos, tutorials, and experiments
Bicep
142
star
72

active-directory-b2c-javascript-nodejs-webapi

A small Node.js Web API for Azure AD B2C that shows how to protect your web api and accept B2C access tokens using Passport.js.
JavaScript
141
star
73

Serverless-APIs

Guidance for building serverless APIs with Azure Functions and API Management.
C#
139
star
74

blockchain-devkit

Samples of how to integrate, connect and use devops to interact with Azure blockchain
Kotlin
138
star
75

storage-blob-dotnet-getting-started

The getting started sample demonstrates how to perform common tasks using the Azure Blob Service in .NET including uploading a blob, CRUD operations, listing, as well as blob snapshot creation.
C#
135
star
76

active-directory-dotnet-webapp-openidconnect-aspnetcore

An ASP.NET Core web application that signs-in Azure AD users from a single Azure AD tenant.
HTML
132
star
77

power-bi-embedded-integrate-report-into-web-app

A Power BI Embedded sample that shows you how to integrate a Power BI report into your own web app
JavaScript
131
star
78

azure-event-grid-viewer

Live view of events from Azure Event Grid with ASP.NET Core and SignalR
HTML
130
star
79

active-directory-dotnet-webapi-manual-jwt-validation

How to manually process a JWT access token in a web API using the JSON Web Token Handler For the Microsoft .Net Framework 4.5.
C#
129
star
80

azure-opensource-labs

Azure Open Source Labs (https://aka.ms/oss-labs)
Bicep
128
star
81

azure-video-indexer-samples

Contains the Azure Media Services Video Indexer samples
Python
128
star
82

active-directory-lab-hybrid-adfs

Create a full AD/CA/ADFS/WAP lab environment with Azure AD Connect installed
PowerShell
125
star
83

service-fabric-dotnet-quickstart

Service Fabric quickstart .net application sample
C#
125
star
84

jmeter-aci-terraform

Scalable cloud load/stress testing pipeline solution with Apache JMeter and Terraform to dynamically provision and destroy the required infrastructure on Azure.
HCL
120
star
85

active-directory-dotnet-desktop-msgraph-v2

Sample showing how a Windows desktop .NET (WPF) application can get an access token using MSAL.NET and call the Microsoft Graph API or other APIs protected by the Microsoft identity platform (Azure Active Directory v2)
C#
120
star
86

active-directory-dotnet-webapp-webapi-openidconnect-aspnetcore

An ASP.NET Core web application that authenticates Azure AD users and calls a web API using OAuth 2.0 access tokens.
C#
119
star
87

ms-identity-aspnet-daemon-webapp

A web application that sync's data from the Microsoft Graph using the identity of the application, instead of on behalf of a user.
C#
117
star
88

active-directory-dotnet-webapp-multitenant-openidconnect

A sample .NET 4.5 MVC web app that signs-up and signs-in users from any Azure AD tenant using OpenID Connect.
JavaScript
116
star
89

azure-intelligent-edge-patterns

Samples for Intelligent Edge Patterns
JavaScript
114
star
90

cognitive-services-sample-data-files

Cognitive Services sample data files
113
star
91

python-docs-hello-world

A simple python application for docs
Python
113
star
92

azure-ai

A hub with a curated awesome list of all Azure AI samples
112
star
93

Cognitive-Speech-STT-Windows

Windows SDK for the Microsoft Speech-to-Text API, part of Cognitive Services
111
star
94

durablefunctions-apiscraping-dotnet

Build an Azure Durable Functions that will scrape GitHub for opened issues and store them on Azure Storage.
C#
111
star
95

active-directory-b2c-xamarin-native

This is a simple Xamarin Forms app showcasing how to use MSAL to authenticate users via Azure Active Directory B2C, and access a Web API with the resulting tokens.
C#
110
star
96

cognitive-services-dotnet-sdk-samples

Learn how to use the Cognitive Services SDKs with these samples
C#
108
star
97

active-directory-dotnet-daemon

A Windows console application that calls a web API using its app identity (instead of a user's identity) to get access tokens in an unattended job or process.
C#
107
star
98

azure-samples-python-management

This repo contains sample code for management libraries of Azure SDK for Python
Python
105
star
99

private-aks-cluster-terraform-devops

This sample shows how to create a private AKS cluster using Terraform and Azure DevOps.
HCL
105
star
100

ms-identity-java-webapp

A Java web application calling Microsoft graph that is secured using the Microsoft identity platform
Java
105
star