2017 © Pedro Peláez
 

library azure-vm-client

Azure Virtual Machines REST API PHP library

image

napche/azure-vm-client

Azure Virtual Machines REST API PHP library

  • Thursday, January 4, 2018
  • by Napche
  • Repository
  • 1 Watchers
  • 0 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

PHP Client for Azure Virtual Machines REST API.

Based on https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines, (*1)

Create an Azure Active Directory (AAD) Application

AAD encourages the use of Applications / Service Principals for authenticating applications. An application / service principal combination provides a service identity to manage your Azure Subscription. Click here to learn about AAD applications and service principals. - Install the Azure CLI - run az login to log into Azure - run az ad sp create-for-rbac to create an Azure Active Directory Application with access to Azure Resource Manager for the current Azure Subscription - If you want to run this for a different Azure Subscription, run az account set --subscription 'your subscription name' - run az account list --query "[?isDefault].id" -o tsv to get your Azure Subscription Id., (*2)

The output of az ad sp create-for-rbac should look like the following:, (*3)

{
  "appId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
  "displayName": "some-display-name",
  "name": "http://azure-cli-2017-04-03-15-30-52",
  "password": "XXXXXXXXXXXXXXXXXXXX",
  "tenant": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}

The values tenant, appId and password are used in the Client constructor., (*4)

Example Usage

        use Azure\Entity\VirtualMachine;
        use Azure\AzureVMClient;
        use Azure\Profile\StorageProfile;

        $resourceGroupName = 'new-resource-group';
        $client->createResourceGroup($resourceGroupName, $region, $tag);

        // Create new machine
        $name = 'new_vm';
        $region = 'westeurope';
        $machine = new VirtualMachine( $name, $region );
        $machine->setResourceGroup( $resourceGroupName );

        // Add or change Profiles..
        $storage = new StorageProfile();
        $machine->setStorageProfile( $storage );

        // Create client with instant authentication.
        $client = new AzureVMClient(
            $subscriptionId,
            $tenant,
            $applicationId,
            $password
        );

        /*
        // Create client and authenticate LATER.
        $client = new AzureVMClient(
            $subscriptionId
        );

        // Do some other stuff.

        $client->authenticate($tenant, $applicationId, $password);
        */

        // Create a VM.
        $client->createVM( $machine );

        // Delete afterwards.
        $client->deleteResourceGroup( $resourceGroupName );

The Versions

04/01 2018

dev-master

9999999-dev https://github.com/Napche/azure-vm-client

Azure Virtual Machines REST API PHP library

  Sources   Download

MIT

The Requires

 

api azure vps vm cloud hosting ssd

04/01 2018

0.0.2

0.0.2.0 https://github.com/Napche/azure-vm-client

Azure Virtual Machines REST API PHP library

  Sources   Download

MIT

The Requires

 

api azure vps vm cloud hosting ssd

04/01 2018

0.0.1

0.0.1.0 https://github.com/Napche/azure-vm-client

Azure Virtual Machines REST API PHP library

  Sources   Download

MIT

The Requires

 

api azure vps vm cloud hosting ssd

03/01 2018

0.0.0

0.0.0.0 https://github.com/Napche/azure-vm-client

Azure Virtual Machines REST API PHP library

  Sources   Download

MIT

The Requires

 

api azure vps vm cloud hosting ssd