1. Go to this page and download the library: Download napche/azure-vm-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
napche / azure-vm-client example snippets
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 );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.