• This repository has been archived on 27/Nov/2023
  • Stars
    star
    415
  • Rank 104,301 (Top 3 %)
  • Language
    PHP
  • License
    Apache License 2.0
  • Created almost 13 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

Microsoft Azure SDK for PHP

Build Status Latest Stable Version

Microsoft Azure SDK for PHP

This project provides a set of PHP client libraries that make it easy to access Microsoft Azure tables, blobs, queues, service bus (queues and topics), service runtime and service management APIs. For documentation on how to host PHP applications on Microsoft Azure, please see the Microsoft Azure PHP Developer Center.

Important Annoucement

As of February 2021, the Azure SDK for PHP has entered a retirement phase and is no longer officially supported by Microsoft. This repository will no longer be maintained.

If you prefer to work in PHP, you can directly call the Azure REST API in PHP

NOTE: Please note that the Azure Storage SDK for PHP will be separately maintained in its own repo

For more details, please refer to our support policy here

Features

  • Tables
  • Blobs
    • create, list, and delete containers, work with container metadata and permissions, list blobs in container
    • create block and page blobs (from a stream or a string), work with blob blocks and pages, delete blobs
    • work with blob properties, metadata, leases, snapshot a blob
    • REST API Version: see https://github.com/Azure/azure-storage-php
  • Storage Queues
  • Service Bus
    • Queues: create, list and delete queues; send, receive, unlock and delete messages
    • Topics: create, list, and delete topics; create, list, and delete subscriptions; send, receive, unlock and delete messages; create, list, and delete rules
  • Service Runtime
    • discover addresses and ports for the endpoints of other role instances in your service
    • get configuration settings and access local resources
    • get role instance information for current role and other role instances
    • query and set the status of the current role
    • REST API Version: 2011-03-08
  • Service Management
    • storage accounts: create, update, delete, list, regenerate keys
    • affinity groups: create, update, delete, list, get properties
    • locations: list
    • hosted services: create, update, delete, list, get properties
    • deployment: create, get, delete, swap, change configuration, update status, upgrade, rollback
    • role instance: reboot, reimage
    • REST API Version: 2011-10-01
  • Media Services
    • Connection
    • Ingest asset, upload files
    • Encoding / process asset, create job, job templates
    • Manage media services entities: create / update / read / delete / get list
    • Delivery SAS and Streaming media content
    • Dynamic encryption: AES and DRM (PlayReady/Widevine/FairPlay) with and without Token restriction
    • Scale encoding reserved unit type
    • Live streaming: live encoding and pass-through channels, programs and all their operations
    • REST API Version: 2.13

Getting Started

Download Source Code

To get the source code from GitHub, type

git clone https://github.com/Azure/azure-sdk-for-php.git
cd ./azure-sdk-for-php

Note

The recommended way to resolve dependencies is to install them using the Composer package manager.

Install via Composer

  • Create a file named composer.json in the root of your project and add the following code to it:

    {
        "require": {
            "microsoft/windowsazure": "^0.5"
        }
    }
  • Download composer.phar in your project root.

  • Open a command prompt and execute this in your project root

    php composer.phar install
    

    Note

    On Windows, you will also need to add the Git executable to your PATH environment variable.

Usage

Getting Started

There are four basic steps that have to be performed before you can make a call to any Microsoft Azure API when using the libraries.

  • First, include the autoloader script:

    require_once "vendor/autoload.php";
  • Include the namespaces you are going to use.

    To create any Microsoft Azure service client you need to use the ServicesBuilder class:

    use WindowsAzure\Common\ServicesBuilder;

    To process exceptions you need:

    use WindowsAzure\Common\ServiceException;
  • To instantiate the service client you will also need a valid connection string. The format is:

    • For accessing a live storage service (tables, blobs, queues):

      DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey]
      
    • For accessing the emulator storage:

      UseDevelopmentStorage=true
      
    • For accessing the Service Bus:

      Endpoint=[yourEndpoint];SharedSecretIssuer=[yourWrapAuthenticationName];SharedSecretValue=[yourWrapPassword]
      

      Where the Endpoint is typically of the format https://[yourNamespace].servicebus.windows.net.

    • For accessing Service Management APIs:

      SubscriptionID=[yourSubscriptionId];CertificatePath=[filePathToYourCertificate]
      
  • Instantiate a "REST Proxy" - a wrapper around the available calls for the given service.

    • For the Storage services:

      $tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString);
      $blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
      $queueRestProxy = ServicesBuilder::getInstance()->createQueueService($connectionString);
    • For Service Bus:

      $serviceBusRestProxy = ServicesBuilder::getInstance()->createServiceBusService($connectionString);
    • For Service Management:

      $serviceManagementRestProxy = ServicesBuilder::getInstance()->createServiceManagementService($connectionString);
    • For Media Services:

      // 1 - Instantiate the credentials
      $credentials = new AzureAdTokenCredentials(
          '<tenant domain name>',
          new AzureAdClientSymmetricKey('<service principal client id>', '<service principal client key>'),
          AzureEnvironments::AZURE_CLOUD_ENVIRONMENT());
      
      // 2 - Instantiate a token provider
      $provider = new AzureAdTokenProvider($credentials);
      
      // 3 - Connect to Azure Media Services
      $mediaServicesRestProxy = ServicesBuilder::getInstance()->createMediaServicesService(new MediaServicesSettings('<rest api endpoint>', $provider));

      You can find more examples for Media Services Authentication on the examples folder.

Table Storage

The following are examples of common operations performed with the Table service. For more please read How-to use the Table service.

Create a table

To create a table call createTable:

try {
  // Create table.
  $tableRestProxy->createTable("mytable");
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Error Codes and Messages for Tables

Insert an entity

To add an entity to a table, create a new Entity object and pass it to TableRestProxy->insertEntity. Note that when you create an entity you must specify a PartitionKey and RowKey. These are the unique identifiers for an entity and are values that can be queried much faster than other entity properties. The system uses PartitionKey to automatically distribute the table’s entities over many storage nodes.

use MicrosoftAzure\Storage\Table\Models\Entity;
use MicrosoftAzure\Storage\Table\Models\EdmType;

$entity = new Entity();
$entity->setPartitionKey("pk");
$entity->setRowKey("1");
$entity->addProperty("PropertyName", EdmType::STRING, "Sample");

try{
  $tableRestProxy->insertEntity("mytable", $entity);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Query entities

To query for entities you can call queryEntities. The subset of entities you retrieve will be determined by the filter you use (for more information, see Querying Tables and Entities). You can also provide no filter at all.

$filter = "RowKey eq '2'";

try {
  $result = $tableRestProxy->queryEntities("mytable", $filter);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

$entities = $result->getEntities();

foreach($entities as $entity){
  echo $entity->getPartitionKey().":".$entity->getRowKey()."<br />";
}

Blob Storage

To get started using the Blob service you must include the BlobService and BlobSettings namespaces and set the ACCOUNT_NAME and ACCOUNT_KEY configuration settings for your credentials. Then you instantiate the wrapper using the BlobService factory.

The following are examples of common operations performed with the Blob serivce. For more please read How-to use the Blob service.

Create a container

// OPTIONAL: Set public access policy and metadata.
// Create container options object.
$createContainerOptions = new CreateContainerOptions();

// Set public access policy. Possible values are
// PublicAccessType::CONTAINER_AND_BLOBS and PublicAccessType::BLOBS_ONLY.
// CONTAINER_AND_BLOBS: full public read access for container and blob data.
// BLOBS_ONLY: public read access for blobs. Container data not available.
// If this value is not specified, container data is private to the account owner.
$createContainerOptions->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS);

// Set container metadata
$createContainerOptions->addMetaData("key1", "value1");
$createContainerOptions->addMetaData("key2", "value2");

try {
  // Create container.
  $blobRestProxy->createContainer("mycontainer", $createContainerOptions);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Error Codes and Messages for Blobs

For more information about container ACLs, see Set Container ACL (REST API).

Upload a blob

To upload a file as a blob, use the BlobRestProxy->createBlockBlob method. This operation will create the blob if it doesn’t exist, or overwrite it if it does. The code example below assumes that the container has already been created and uses fopen to open the file as a stream.

$content = fopen("myfile.txt", "r");
$blob_name = "myblob";

try {
  //Upload blob
  $blobRestProxy->createBlockBlob("mycontainer", $blob_name, $content);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

While the example above uploads a blob as a stream, a blob can also be uploaded as a string.

List blobs in a container

To list the blobs in a container, use the BlobRestProxy->listBlobs method with a foreach loop to loop through the result. The following code outputs the name and URI of each blob in a container.

try {
  // List blobs.
  $blob_list = $blobRestProxy->listBlobs("mycontainer");
  $blobs = $blob_list->getBlobs();

  foreach($blobs as $blob)
  {
    echo $blob->getName().": ".$blob->getUrl()."<br />";
  }
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Storage Queues

To get started using the Queue service you must include the QueueService and QueueSettings namespaces and set the ACCOUNT_NAME and ACCOUNT_KEY configuration settings for your credentials. Then you instantiate the wrapper using the QueueService factory.

The following are examples of common operations performed with the Queue serivce. For more please read How-to use the Queue service.

Create a queue

A QueueRestProxy object lets you create a queue with the createQueue method. When creating a queue, you can set options on the queue, but doing so is not required.

$createQueueOptions = new CreateQueueOptions();
$createQueueOptions->addMetaData("key1", "value1");
$createQueueOptions->addMetaData("key2", "value2");

try {
  // Create queue.
  $queueRestProxy->createQueue("myqueue", $createQueueOptions);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Error Codes and Messages for Queues

Add a message to a queue

To add a message to a queue, use QueueRestProxy->createMessage. The method takes the queue name, the message text, and message options (which are optional). For compatibility with others you may need to base64 encode message.

try {
  // Create message.
  $msg = "Hello World!";
  // optional: $msg = base64_encode($msg);
  $queueRestProxy->createMessage("myqueue", $msg);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Peek at the next message

You can peek at a message (or messages) at the front of a queue without removing it from the queue by calling QueueRestProxy->peekMessages.

// OPTIONAL: Set peek message options.
$message_options = new PeekMessagesOptions();
$message_options->setNumberOfMessages(1); // Default value is 1.

try {
  $peekMessagesResult = $queueRestProxy->peekMessages("myqueue", $message_options);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

$messages = $peekMessagesResult->getQueueMessages();

// View messages.
$messageCount = count($messages);
if($messageCount <= 0){
  echo "There are no messages.<br />";
}
else{
  foreach($messages as $message)  {
    echo "Peeked message:<br />";
    echo "Message Id: ".$message->getMessageId()."<br />";
    echo "Date: ".date_format($message->getInsertionDate(), 'Y-m-d')."<br />";
    echo "Message text: ".$message->getMessageText()."<br /><br />";
  }
}

De-queue the next message

Your code removes a message from a queue in two steps. First, you call QueueRestProxy->listMessages, which makes the message invisible to any other code reading from the queue. By default, this message will stay invisible for 30 seconds (if the message is not deleted in this time period, it will become visible on the queue again). To finish removing the message from the queue, you must call QueueRestProxy->deleteMessage.

// Get message.
$listMessagesResult = $queueRestProxy->listMessages("myqueue");
$messages = $listMessagesResult->getQueueMessages();
$message = $messages[0];

// Process message

// Get message Id and pop receipt.
$messageId = $message->getMessageId();
$popReceipt = $message->getPopReceipt();

try {
  // Delete message.
  $queueRestProxy->deleteMessage("myqueue", $messageId, $popReceipt);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Service Bus Queues

The current PHP Service Bus APIs only support ACS connection strings. You need to use PowerShell to create a new ACS Service Bus namespace at the present time. First, make sure you have Azure PowerShell installed, then in a PowerShell command prompt, run

Add-AzureAccount # this will sign you in
New-AzureSBNamespace -CreateACSNamespace $true -Name 'mytestbusname' -Location 'West US' -NamespaceType 'Messaging'

If it is sucessful, you will get the connection string in the PowerShell output. If you get connection errors with it and the conection string looks like Endpoint=sb://..., change it to Endpoint=https://...

Create a Queue

try {
  $queueInfo = new QueueInfo("myqueue");

  // Create queue.
  $serviceBusRestProxy->createQueue($queueInfo);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Error Codes and Messages

Send a Message

To send a message to a Service Bus queue, your application will call the ServiceBusRestProxy->sendQueueMessage method. Messages sent to (and received from ) Service Bus queues are instances of the BrokeredMessage class.

try {
  // Create message.
  $message = new BrokeredMessage();
  $message->setBody("my message");

  // Send message.
  $serviceBusRestProxy->sendQueueMessage("myqueue", $message);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Receive a Message

The primary way to receive messages from a queue is to use a ServiceBusRestProxy->receiveQueueMessage method. Messages can be received in two different modes: ReceiveAndDelete (mark message as consumed on read) and PeekLock (locks message for a period of time, but does not delete).

The example below demonstrates how a message can be received and processed using PeekLock mode (not the default mode).

try {
  // Set the receive mode to PeekLock (default is ReceiveAndDelete).
  $options = new ReceiveMessageOptions();
  $options->setPeekLock(true);

  // Receive message.
  $message = $serviceBusRestProxy->receiveQueueMessage("myqueue", $options);
  echo "Body: ".$message->getBody()."<br />";
  echo "MessageID: ".$message->getMessageId()."<br />";

  // *** Process message here ***

  // Delete message.
  $serviceBusRestProxy->deleteMessage($message);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Service Bus Topics

Create a Topic

try {
  // Create topic.
  $topicInfo = new TopicInfo("mytopic");
  $serviceBusRestProxy->createTopic($topicInfo);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Create a subscription with the default (MatchAll) filter

try {
  // Create subscription.
  $subscriptionInfo = new SubscriptionInfo("mysubscription");
  $serviceBusRestProxy->createSubscription("mytopic", $subscriptionInfo);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Send a message to a topic

Messages sent to Service Bus topics are instances of the BrokeredMessage class.

try {
  // Create message.
  $message = new BrokeredMessage();
  $message->setBody("my message");

  // Send message.
  $serviceBusRestProxy->sendTopicMessage("mytopic", $message);
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Receive a message from a topic

The primary way to receive messages from a subscription is to use a ServiceBusRestProxy->receiveSubscriptionMessage method. Received messages can work in two different modes: ReceiveAndDelete (the default) and PeekLock similarly to Service Bus Queues.

The example below demonstrates how a message can be received and processed using ReceiveAndDelete mode (the default mode).

try {
  // Set receive mode to PeekLock (default is ReceiveAndDelete)
  $options = new ReceiveMessageOptions();
  $options->setReceiveAndDelete();

  // Get message.
  $message = $serviceBusRestProxy->receiveSubscriptionMessage("mytopic",
                                "mysubscription",
                                $options);
  echo "Body: ".$message->getBody()."<br />";
  echo "MessageID: ".$message->getMessageId()."<br />";
} catch(ServiceException $e){
  $code = $e->getCode();
  $error_message = $e->getMessage();
  echo $code.": ".$error_message."<br />";
}

Service Management

Set-up certificates

You need to create two certificates, one for the server (a .cer file) and one for the client (a .pem file). To create the .pem file using OpenSSL, execute this:

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

To create the .cer certificate, execute this:

openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer

List Available Locations

$serviceManagementRestProxy->listLocations();
$locations = $result->getLocations();
foreach($locations as $location){
      echo $location->getName()."<br />";
}

Create a Storage Service

To create a storage service, you need a name for the service (between 3 and 24 lowercase characters and unique within Microsoft Azure), a label (a base-64 encoded name for the service, up to 100 characters), and either a location or an affinity group. Providing a description for the service is optional.

$name = "mystorageservice";
$label = base64_encode($name);
$options = new CreateStorageServiceOptions();
$options->setLocation('West US');

$result = $serviceManagementRestProxy->createStorageService($name, $label, $options);

Create a Cloud Service

A cloud service is also known as a hosted service (from earlier versions of Microsoft Azure). The createHostedServices method allows you to create a new hosted service by providing a hosted service name (which must be unique in Microsoft Azure), a label (the base 64-endcoded hosted service name), and a CreateServiceOptions object which allows you to set the location or the affinity group for your service.

$name = "myhostedservice";
$label = base64_encode($name);
$options = new CreateServiceOptions();
$options->setLocation('West US');
// Instead of setLocation, you can use setAffinityGroup to set an affinity group.

$result = $serviceManagementRestProxy->createHostedService($name, $label, $options);

Create a Deployment

To make a new deployment to Azure you must store the package file in a Microsoft Azure Blob Storage account under the same subscription as the hosted service to which the package is being uploaded. You can create a deployment package with the Microsoft Azure PowerShell cmdlets, or with the cspack commandline tool.

$hostedServiceName = "myhostedservice";
$deploymentName = "v1";
$slot = DeploymentSlot::PRODUCTION;
$packageUrl = "URL_for_.cspkg_file";
$configuration = file_get_contents('path_to_.cscfg_file');
$label = base64_encode($hostedServiceName);

$result = $serviceManagementRestProxy->createDeployment($hostedServiceName,
                         $deploymentName,
                         $slot,
                         $packageUrl,
                         $configuration,
                         $label);

$status = $serviceManagementRestProxy->getOperationStatus($result);
echo "Operation status: ".$status->getStatus()."<br />";

Media Services

Create new asset with file

To create an asset with a file you need to create an empty asset, create access policy with write permission, create a locator joining your asset and access policy, perform actual upload and generate file info.

$asset = new Asset(Asset::OPTIONS_NONE);
$asset = $restProxy->createAsset($asset);

$access = new AccessPolicy('[Some access policy name]');
$access->setDurationInMinutes([Munites AccessPolicy is valid]);
$access->setPermissions(AccessPolicy::PERMISSIONS_WRITE);
$access = $restProxy->createAccessPolicy($access);

$sasLocator = new Locator($asset,  $access, Locator::TYPE_SAS);
$sasLocator->setStartTime(new \DateTime('now -5 minutes'));
$sasLocator = $restProxy->createLocator($sasLocator);

$restProxy->uploadAssetFile($sasLocator, '[file name]', '[file content]');
$restProxy->createFileInfos($asset);

Encode asset

To perform media file encoding you will need input asset ($inputAsset) with a file in it (something like in previous chapter). Also you need to create an array of task data objects and a job data object. To create a task object use a media processor, task XML body and configuration name.

$mediaProcessor = $this->restProxy->getLatestMediaProcessor('[Media processor]');

$task = new Task('[Task XML body]', $mediaProcessor->getId(), TaskOptions::NONE);
$task->setConfiguration('[Configuration name]');

$restProxy->createJob(new Job(), array($inputAsset), array($task));

Get public URL to encoded asset

After you’ve uploaded a media file and encode it you can get a download URL for that file or a streaming URL for multiple bitrate files. Create a new access policy with read permission and link it with job output asset via locator.

$accessPolicy = new AccessPolicy('[Some access policy name]');
$accessPolicy->setDurationInMinutes([Munites AccessPolicy is valid]);
$accessPolicy->setPermissions(AccessPolicy::PERMISSIONS_READ);
$accessPolicy = $restProxy->createAccessPolicy($accessPolicy);

// Download URL
$sasLocator = new Locator($asset, $accessPolicy, Locator::TYPE_SAS);
$sasLocator->setStartTime(new \DateTime('now -5 minutes'));
$sasLocator = $restProxy->createLocator($sasLocator);

// Azure needs time to publish media
sleep(30);

$downloadUrl = $sasLocator->getBaseUri() . '/' . '[File name]' . $sasLocator->getContentAccessComponent()

// Streaming URL
$originLocator = new Locator($asset, $accessPolicy, Locator::TYPE_ON_DEMAND_ORIGIN);
$originLocator = $restProxy->createLocator($originLocator);

// Azure needs time to publish media
sleep(30);

$streamingUrl = $originLocator->getPath() . '[Manifest file name]' . "/manifest";

Manage media services entities

Media services CRUD operations are performed through media services rest proxy class. It has methods like “createAsset”, “createLocator”, “createJob” and etc. for entities creations.

To retrieve all entities list you may use methods “getAssetList”, “getAccessPolicyList”, “getLocatorList”, “getJobList” and etc. For getting single entity data use methods “getAsset”, “getJob”, “getTask” and etc. passing the entity identifier or entity data model object with non-empty identifier as a parameter.

Update entities with methods like “updateLocator”, “updateAsset”, “updateAssetFile” and etc. passing the entity data model object as a parameter. It is important to have valid entity identifier specified in data model object.

Erase entities with methods like “deleteAsset”, “deleteAccessPolicy”, “deleteJob” and etc. passing the entity identifier or entity data model object with non-empty identifier as a parameter.

Also you could get linked entities with methods “getAssetLocators”, “getAssetParentAssets”, “getAssetStorageAccount”, “getLocatorAccessPolicy”, “getJobTasks” and etc. passing the entity identifier or entity data model object with non-empty identifier as a parameter.

The complete list of all methods available you could find in IMediaServices interface.

For more examples please see the Microsoft Azure PHP Developer Center

Need Help?

Be sure to check out the Microsoft Azure Developer Forums on Stack Overflow if you have trouble with the provided code.

Contribute Code or Provide Feedback

If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.

To setup your development environment, follow the instructions in this wiki page.

If you encounter any bugs with the library please file an issue in the Issues section of the project.

Learn More

Microsoft Azure PHP Developer Center

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

More Repositories

1

azure-quickstart-templates

Azure Quickstart Templates
Bicep
13,949
star
2

azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
C#
5,256
star
3

autorest

OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python
TypeScript
4,594
star
4

Azure-Sentinel

Cloud-native SIEM for intelligent security analytics for your entire enterprise.
Jupyter Notebook
4,559
star
5

azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
Python
4,540
star
6

azure-powershell

Microsoft Azure PowerShell
C#
4,178
star
7

MachineLearningNotebooks

Python notebooks with ML and deep learning examples with Azure Machine Learning Python SDK | Microsoft
Jupyter Notebook
4,090
star
8

DotNetty

DotNetty project – a port of netty, event-driven asynchronous network application framework
C#
4,087
star
9

azure-cli

Azure Command-Line Interface
Python
3,930
star
10

draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
Go
3,925
star
11

bicep

Bicep is a declarative language for describing and deploying Azure resources
Bicep
3,240
star
12

azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
HCL
2,634
star
13

azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
Java
2,305
star
14

azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
TypeScript
2,051
star
15

AKS

Azure Kubernetes Service
HTML
1,965
star
16

azure-functions-host

The host/runtime that powers Azure Functions
C#
1,871
star
17

golua

A Lua 5.3 engine implemented in Go
Go
1,850
star
18

Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
TypeScript
1,823
star
19

azureml-examples

Official community-driven Azure Machine Learning examples, tested with GitHub Actions.
Jupyter Notebook
1,733
star
20

Microsoft-Defender-for-Cloud

Welcome to the Microsoft Defender for Cloud community repository
PowerShell
1,677
star
21

Enterprise-Scale

The Azure Landing Zones (Enterprise-Scale) architecture provides prescriptive guidance coupled with Azure best practices, and it follows design principles across the critical design areas for organizations to define their Azure architecture
PowerShell
1,603
star
22

azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
Go
1,594
star
23

Stormspotter

Azure Red Team tool for graphing Azure and Azure Active Directory objects
Python
1,525
star
24

durabletask

Durable Task Framework allows users to write long running persistent workflows in C# using the async/await capabilities.
C#
1,516
star
25

azure-policy

Repository for Azure Resource Policy built-in definitions and samples
Open Policy Agent
1,485
star
26

iotedge

The IoT Edge OSS project
C#
1,421
star
27

aztfexport

A tool to bring existing Azure resources under Terraform's management
Go
1,335
star
28

review-checklists

This repo contains code and examples to operationalize Azure review checklists.
Python
1,187
star
29

azure-sdk-for-node

Azure SDK for Node.js - Documentation
JavaScript
1,187
star
30

azure-functions-core-tools

Command line tools for Azure Functions
C#
1,128
star
31

Azure-Functions

PowerShell
1,108
star
32

acs-engine

WE HAVE MOVED: Please join us at Azure/aks-engine!
Go
1,031
star
33

aks-engine

AKS Engine: legacy tool for Kubernetes on Azure (see status)
Go
1,027
star
34

data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
C#
912
star
35

terraform-azurerm-caf-enterprise-scale

Azure landing zones Terraform module
HCL
856
star
36

coco-framework

The Confidential Consortium Blockchain Framework is an open-source system that enables high-scale, confidential blockchain networks that meet all key enterprise requirements—providing a means to accelerate production enterprise adoption of blockchain technology.
834
star
37

azure-iot-sdks

SDKs for a variety of languages and platforms that help connect devices to Microsoft Azure IoT services
829
star
38

GPT-RAG

Sharing the learning along the way we been gathering to enable Azure OpenAI at enterprise scale in a secure manner. GPT-RAG core is a 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.
Bicep
822
star
39

AzurePublicDataset

Microsoft Azure Traces
Jupyter Notebook
790
star
40

azure-sql-database-samples

Azure SQL Database Samples and Reference Implementation Repository
Python
781
star
41

Azure-Network-Security

Resources for improving Customer Experience with Azure Network Security
Python
768
star
42

caf-terraform-landingzones

This solution, offered by the Open-Source community, will no longer receive contributions from Microsoft. Customers are encouraged to transition to Microsoft Azure Verified Modules for continued support and updates from Microsoft. Please note, this repository is scheduled for decommissioning and will be removed on July 1, 2025.
HCL
763
star
43

azure-search-vector-samples

A repository of code samples for Vector search capabilities in Azure AI Search.
Jupyter Notebook
750
star
44

azure-service-operator

Azure Service Operator allows you to create Azure resources using kubectl
Go
741
star
45

azure-functions-durable-extension

Durable Task Framework extension for Azure Functions
C#
714
star
46

azure-webjobs-sdk

Azure WebJobs SDK
C#
712
star
47

ResourceModules

This repository includes a CI platform for and collection of mature and curated Bicep modules. The platform supports both ARM and Bicep and can be leveraged using GitHub actions as well as Azure DevOps pipelines.
Bicep
710
star
48

ALZ-Bicep

This repository contains the Azure Landing Zones (ALZ) Bicep modules that help deliver and deploy the Azure Landing Zone conceptual architecture in a modular approach. https://aka.ms/alz/docs
Bicep
694
star
49

azure-sdk-for-rust

This repository is for active development of the *unofficial* Azure SDK for Rust. This repository is *not* supported by the Azure SDK team.
Rust
692
star
50

terraform

Source code for the Azure Marketplace Terraform development VM package.
HCL
690
star
51

azure-api-management-devops-resource-kit

Azure API Management DevOps Resource Kit
C#
684
star
52

application-gateway-kubernetes-ingress

This is an ingress controller that can be run on Azure Kubernetes Service (AKS) to allow an Azure Application Gateway to act as the ingress for an AKS cluster.
Go
668
star
53

CCOInsights

Welcome to the Continuous Cloud Optimization Power BI Dashboard GitHub Project. In this repository you will find all the guidance and files needed to deploy the Dashboard in your environment to take benefit of a single pane of glass to get insights about your Azure resources and services.
Mathematica
668
star
54

SimuLand

Understand adversary tradecraft and improve detection strategies
PowerShell
664
star
55

DeepLearningForTimeSeriesForecasting

A tutorial demonstrating how to implement deep learning models for time series forecasting
Jupyter Notebook
655
star
56

azure-xplat-cli

For ARM-based service please go to CLI 2.0.
JavaScript
651
star
57

azure-cosmos-dotnet-v3

.NET SDK for Azure Cosmos DB for the core SQL API
C#
637
star
58

node-sqlserver

C++
625
star
59

azure-devops-cli-extension

Azure DevOps Extension for Azure CLI
Python
621
star
60

azure-storage-fuse

A virtual file system adapter for Azure Blob storage
Go
613
star
61

Community-Policy

This repo is for Microsoft Azure customers and Microsoft teams to collaborate in making custom policies.
Open Policy Agent
612
star
62

azure-resource-manager-schemas

Schemas used to author and validate Resource Manager Templates. These schemas power the intellisense and syntax completion in our ARM Tools VSCode extension, as well as the Export Template API
TypeScript
610
star
63

azure-storage-azcopy

The new Azure Storage data transfer utility - AzCopy v10
Go
607
star
64

counterfit

a CLI that provides a generic automation layer for assessing the security of ML models
Python
599
star
65

azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
C
587
star
66

azure-cosmos-dotnet-v2

Contains samples and utilities relating to the Azure Cosmos DB .NET SDK
577
star
67

azure-service-bus

☁️ Azure Service Bus service issue tracking and samples
571
star
68

aad-pod-identity

[DEPRECATED] Assign Azure Active Directory Identities to Kubernetes applications.
Go
569
star
69

Azure-Sentinel-Notebooks

Interactive Azure Sentinel Notebooks provides security insights and actions to investigate anomalies and hunt for malicious behaviors.
Jupyter Notebook
541
star
70

draft

A day 0 tool for getting your app on k8s fast
Go
541
star
71

AzureStack-QuickStart-Templates

Quick start ARM templates that deploy on Microsoft Azure Stack
PowerShell
540
star
72

azure-openai-samples

Azure OpenAI Samples is a collection of code samples illustrating how to use Azure Open AI in creating AI solution for various use cases across industries. This repository is mained by a community of volunters. We welcomed your contributions.
Jupyter Notebook
540
star
73

WALinuxAgent

Microsoft Azure Linux Guest Agent
Python
538
star
74

AI-in-a-Box

AI-in-a-Box leverages the expertise of Microsoft across the globe to develop and provide AI and ML solutions to the technical community. Our intent is to present a curated collection of solution accelerators that can help engineers establish their AI/ML environments and solutions rapidly and with minimal friction.
Jupyter Notebook
529
star
75

iot-edge-v1

Azure IoT Edge
C
524
star
76

Industrial-IoT

Azure Industrial IoT Platform
C#
521
star
77

MS-AMP

Microsoft Automatic Mixed Precision Library
Python
516
star
78

Mission-Critical

This repository provides a design methodology and approach to building highly-reliable applications on Microsoft Azure for mission-critical workloads.
510
star
79

static-web-apps-cli

Azure Static Web Apps CLI ✨
TypeScript
509
star
80

mlops-v2

Azure MLOps (v2) solution accelerators. Enterprise ready templates to deploy your machine learning models on the Azure Platform.
Shell
505
star
81

azure-docs-powershell-samples

Azure Powershell code samples, often used in docs.microsoft.com/Azure developer documentation
PowerShell
503
star
82

azqr

Azure Quick Review
Go
503
star
83

bicep-registry-modules

Bicep registry modules
Bicep
501
star
84

azure-storage-node

Microsoft Azure Storage SDK for Node.js
JavaScript
495
star
85

api-management-developer-portal

Developer portal provided by the Azure API Management service.
TypeScript
487
star
86

kubelogin

A Kubernetes credential (exec) plugin implementing azure authentication
Go
486
star
87

Azure-TDSP-ProjectTemplate

TDSP: Data science project template repository with standardized directory structure and document templates to support efficient project execution and collaboration.
R
483
star
88

azure-sdk

This is the Azure SDK parent repository and mostly contains documentation around guidelines and policies as well as the releases for the various languages supported by the Azure SDK.
PowerShell
478
star
89

azure-mobile-services

Mobile Services is deprecated - Use Mobile Apps instead
HTML
472
star
90

azure-devtestlab

Azure DevTestLab artifacts, scripts and samples
PowerShell
458
star
91

azure-iot-sdk-csharp

A C# SDK for connecting devices to Microsoft Azure IoT services
C#
455
star
92

actions-workflow-samples

Help developers to easily get started with GitHub Action workflows to deploy to Azure
Pug
450
star
93

azure-devops-utils

Azure DevOps Utilities
Shell
450
star
94

AzureDatabricksBestPractices

Version 1 of Technical Best Practices of Azure Databricks based on real world Customer and Technical SME inputs
446
star
95

app-service-announcements

Subscribe to this repo to be notified about major changes in App Service
446
star
96

azure-storage-net

Microsoft Azure Storage Libraries for .NET
C#
445
star
97

Azure-DataFactory

C#
444
star
98

arm-ttk

Azure Resource Manager Template Toolkit
PowerShell
442
star
99

RDS-Templates

ARM Templates for Remote Desktop Services deployments
PowerShell
427
star
100

Copilot-For-Security

Microsoft Copilot for Security is a generative AI-powered security solution that helps increase the efficiency and capabilities of defenders to improve security outcomes at machine speed and scale, while remaining compliant to responsible AI principles
PowerShell
426
star