Skip to content

Commit

Permalink
Release 1.22.2
Browse files Browse the repository at this point in the history
  • Loading branch information
anuchandy committed Jun 18, 2019
1 parent 4425228 commit d5e125a
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Asset/create_resources_with_msi.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/bin/bash

/usr/bin/yes | sudo apt-get update
/usr/bin/yes | sudo apt install python-pip
/usr/bin/yes | sudo pip install --upgrade pip
sudo pip install azure-cli
az login --identity -u $1
az storage account create -n $2 -g $3 -l $4 --sku Premium_LRS
az storage account create -n $2 -g $3 -l $4 --sku Premium_LRS
4 changes: 2 additions & 2 deletions Asset/install_apache.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/bash

sudo apt-get update

# install apache
sudo apt-get -y install apache2

# restart Apache
sudo apachectl restart
sudo service apache2 restart
244 changes: 236 additions & 8 deletions Common/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2338,8 +2338,6 @@ public static void Print(IBatchAICluster resource)
StringBuilder sb = new StringBuilder("Batch AI cluster: ")
.Append("\n\tId: ").Append(resource.Id)
.Append("\n\tName: ").Append(resource.Name)
.Append("\n\tResource group: ").Append(resource.ResourceGroupName)
.Append("\n\tRegion: ").Append(resource.RegionName)
.Append("\n\tVM Size: ").Append(resource.VMSize)
.Append("\n\tVM Priority: ").Append(resource.VMPriority)
.Append("\n\tSubnet: ").Append(resource.Subnet)
Expand All @@ -2361,7 +2359,7 @@ public static void Print(IBatchAICluster resource)
sb.Append("\n\tManual scale settings: ")
.Append("\n\t\tTarget node count: ").Append(resource.ScaleSettings.Manual.TargetNodeCount)
.Append("\n\t\tDeallocation option: ")
.Append(resource.ScaleSettings.Manual.NodeDeallocationOption.GetValueOrDefault());
.Append(resource.ScaleSettings.Manual.NodeDeallocationOption);
}
if (resource.NodeStateCounts != null)
{
Expand All @@ -2384,7 +2382,6 @@ public static void Print(IBatchAICluster resource)
{
sb.Append("\n\tSetup task: ")
.Append("\n\t\tCommand line: ").Append(resource.NodeSetup.SetupTask.CommandLine)
.Append("\n\t\tRun elevated: ").Append(resource.NodeSetup.SetupTask.RunElevated)
.Append("\n\t\tStdout/err Path Prefix: ").Append(resource.NodeSetup.SetupTask.StdOutErrPathPrefix);
}
Utilities.Log(sb.ToString());
Expand All @@ -2395,19 +2392,250 @@ public static void Print(IBatchAIJob resource)
StringBuilder sb = new StringBuilder("Batch AI job: ")
.Append("\n\tId: ").Append(resource.Id)
.Append("\n\tName: ").Append(resource.Name)
.Append("\n\tResource group: ").Append(resource.ResourceGroupName)
.Append("\n\tRegion: ").Append(resource.RegionName)
.Append("\n\tCluster Id: ").Append(resource.Cluster)
.Append("\n\tCreation time: ").Append(resource.CreationTime)
.Append("\n\tNode count: ").Append(resource.NodeCount)
.Append("\n\tPriority: ").Append(resource.Priority)
.Append("\n\tPriority: ").Append(resource.SchedulingPriority)
.Append("\n\tExecution state: ").Append(resource.ExecutionState)
.Append("\n\tExecution state transition time: ").Append(resource.ExecutionStateTransitionTime)
.Append("\n\tTool type: ").Append(resource.ToolType)
.Append("\n\tExperiment name: ").Append(resource.ExperimentName);
.Append("\n\tExperiment name: ").Append(resource.Experiment.Name);
Utilities.Log(sb.ToString());
}

/**
* Print Action group settings.
*
* @param actionGroup action group instance
*/
public static void Print(IActionGroup actionGroup)
{
StringBuilder info = new StringBuilder("Action Group: ")
.Append("\n\tId: ").Append(actionGroup.Id)
.Append("\n\tName: ").Append(actionGroup.Name)
.Append("\n\tShort Name: ").Append(actionGroup.ShortName);

if (actionGroup.EmailReceivers != null && actionGroup.EmailReceivers.Any())
{
info.Append("\n\tEmail receivers: ");
foreach (var er in actionGroup.EmailReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tEMail: ").Append(er.EmailAddress);
info.Append("\n\t\tStatus: ").Append(er.Status);
info.Append("\n\t\t===");
}
}

if (actionGroup.SmsReceivers != null && actionGroup.SmsReceivers.Any())
{
info.Append("\n\tSMS text message receivers: ");
foreach (var er in actionGroup.SmsReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tPhone: ").Append(er.CountryCode + er.PhoneNumber);
info.Append("\n\t\tStatus: ").Append(er.Status);
info.Append("\n\t\t===");
}
}

if (actionGroup.WebhookReceivers != null && actionGroup.WebhookReceivers.Any())
{
info.Append("\n\tWebhook receivers: ");
foreach (var er in actionGroup.WebhookReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tURI: ").Append(er.ServiceUri);
info.Append("\n\t\t===");
}
}

if (actionGroup.PushNotificationReceivers != null && actionGroup.PushNotificationReceivers.Any())
{
info.Append("\n\tApp Push Notification receivers: ");
foreach (var er in actionGroup.PushNotificationReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tEmail: ").Append(er.EmailAddress);
info.Append("\n\t\t===");
}
}

if (actionGroup.VoiceReceivers != null && actionGroup.VoiceReceivers.Any())
{
info.Append("\n\tVoice Message receivers: ");
foreach (var er in actionGroup.VoiceReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tPhone: ").Append(er.CountryCode + er.PhoneNumber);
info.Append("\n\t\t===");
}
}

if (actionGroup.AutomationRunbookReceivers != null && actionGroup.AutomationRunbookReceivers.Any())
{
info.Append("\n\tAutomation Runbook receivers: ");
foreach (var er in actionGroup.AutomationRunbookReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tRunbook Name: ").Append(er.RunbookName);
info.Append("\n\t\tAccount Id: ").Append(er.AutomationAccountId);
info.Append("\n\t\tIs Global: ").Append(er.IsGlobalRunbook);
info.Append("\n\t\tService URI: ").Append(er.ServiceUri);
info.Append("\n\t\tWebhook resource Id: ").Append(er.WebhookResourceId);
info.Append("\n\t\t===");
}
}

if (actionGroup.AzureFunctionReceivers != null && actionGroup.AzureFunctionReceivers.Any())
{
info.Append("\n\tAzure Functions receivers: ");
foreach(var er in actionGroup.AzureFunctionReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tFunction Name: ").Append(er.FunctionName);
info.Append("\n\t\tFunction App Resource Id: ").Append(er.FunctionAppResourceId);
info.Append("\n\t\tFunction Trigger URI: ").Append(er.HttpTriggerUrl);
info.Append("\n\t\t===");
}
}

if (actionGroup.LogicAppReceivers != null && actionGroup.LogicAppReceivers.Any())
{
info.Append("\n\tLogic App receivers: ");
foreach (var er in actionGroup.LogicAppReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tResource Id: ").Append(er.ResourceId);
info.Append("\n\t\tCallback URL: ").Append(er.CallbackUrl);
info.Append("\n\t\t===");
}
}

if (actionGroup.ItsmReceivers != null && actionGroup.ItsmReceivers.Any())
{
info.Append("\n\tITSM receivers: ");
foreach(var er in actionGroup.ItsmReceivers)
{
info.Append("\n\t\tName: ").Append(er.Name);
info.Append("\n\t\tWorkspace Id: ").Append(er.WorkspaceId);
info.Append("\n\t\tConnection Id: ").Append(er.ConnectionId);
info.Append("\n\t\tRegion: ").Append(er.Region);
info.Append("\n\t\tTicket Configuration: ").Append(er.TicketConfiguration);
info.Append("\n\t\t===");
}
}
Utilities.Log(info.ToString());
}

/**
* Print activity log alert settings.
*
* @param activityLogAlert activity log instance
*/
public static void Print(IActivityLogAlert activityLogAlert)
{

StringBuilder info = new StringBuilder("Activity Log Alert: ")
.Append("\n\tId: ").Append(activityLogAlert.Id)
.Append("\n\tName: ").Append(activityLogAlert.Name)
.Append("\n\tDescription: ").Append(activityLogAlert.Description)
.Append("\n\tIs Enabled: ").Append(activityLogAlert.Enabled);

if (activityLogAlert.Scopes != null && activityLogAlert.Scopes.Any())
{
info.Append("\n\tScopes: ");
foreach (var er in activityLogAlert.Scopes)
{
info.Append("\n\t\tId: ").Append(er);
}
}

if (activityLogAlert.ActionGroupIds != null && activityLogAlert.ActionGroupIds.Any())
{
info.Append("\n\tAction Groups: ");
foreach(var er in activityLogAlert.ActionGroupIds)
{
info.Append("\n\t\tAction Group Id: ").Append(er);
}
}

if (activityLogAlert.EqualsConditions != null && activityLogAlert.EqualsConditions.Any())
{
info.Append("\n\tAlert conditions (when all of is true): ");
foreach (var er in activityLogAlert.EqualsConditions)
{
info.Append("\n\t\t'").Append(er.Key).Append("' equals '").Append(er.Value).Append("'");
}
}
Utilities.Log(info.ToString());
}

/**
* Print metric alert settings.
*
* @param metricAlert metric alert instance
*/
public static void Print(IMetricAlert metricAlert)
{

StringBuilder info = new StringBuilder("Metric Alert: ")
.Append("\n\tId: ").Append(metricAlert.Id)
.Append("\n\tName: ").Append(metricAlert.Name)
.Append("\n\tDescription: ").Append(metricAlert.Description)
.Append("\n\tIs Enabled: ").Append(metricAlert.Enabled)
.Append("\n\tIs Auto Mitigated: ").Append(metricAlert.AutoMitigate)
.Append("\n\tSeverity: ").Append(metricAlert.Severity)
.Append("\n\tWindow Size: ").Append(metricAlert.WindowSize)
.Append("\n\tEvaluation Frequency: ").Append(metricAlert.EvaluationFrequency);

if (metricAlert.Scopes != null && metricAlert.Scopes.Any())
{
info.Append("\n\tScopes: ");
foreach (var er in metricAlert.Scopes)
{
info.Append("\n\t\tId: ").Append(er);
}
}

if (metricAlert.ActionGroupIds != null && metricAlert.ActionGroupIds.Any())
{
info.Append("\n\tAction Groups: ");
foreach (var er in metricAlert.ActionGroupIds)
{
info.Append("\n\t\tAction Group Id: ").Append(er);
}
}

if (metricAlert.AlertCriterias != null && metricAlert.AlertCriterias.Any())
{
info.Append("\n\tAlert conditions (when all of is true): ");
foreach (var er in metricAlert.AlertCriterias)
{
var alertCondition = er.Value;
info.Append("\n\t\tCondition name: ").Append(er.Key)
.Append("\n\t\tSignal name: ").Append(alertCondition.MetricName)
.Append("\n\t\tMetric Namespace: ").Append(alertCondition.MetricNamespace)
.Append("\n\t\tOperator: ").Append(alertCondition.Condition)
.Append("\n\t\tThreshold: ").Append(alertCondition.Threshold)
.Append("\n\t\tTime Aggregation: ").Append(alertCondition.TimeAggregation);
if (alertCondition.Dimensions != null && alertCondition.Dimensions.Any())
{
foreach (var dimon in alertCondition.Dimensions)
{
info.Append("\n\t\tDimension Filter: ").Append("Name [").Append(dimon.Name).Append("] operator [Include] values[");
foreach (var vals in dimon.Values)
{
info.Append(vals).Append(", ");
}
info.Append("]");
}
}
}
}
Utilities.Log(info.ToString());
}

public static void CreateCertificate(string domainName, string pfxPath, string password)
{
if (!IsRunningMocked)
Expand Down
6 changes: 3 additions & 3 deletions ManageVirtualMachineScaleSet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.12" />
<PackageReference Include="Microsoft.Azure.Management.Fluent" Version="1.14.0" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="2.3.2" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.18" />
<PackageReference Include="Microsoft.Azure.Management.Fluent" Version="1.22.2" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.1" />
<PackageReference Include="CoreFTP" Version="1.2.0" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="0.0.2-preview" />
<PackageReference Include="SSH.NET" Version="2016.0.0" />
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
services: Compute
platforms: dotnet
author: selvasingh
author: yaohaizh
---

# Getting started on managing virtual machine scale sets in C# #
Expand All @@ -22,7 +22,7 @@ author: selvasingh

To run this sample:

Set the environment variable `AZURE_AUTH_LOCATION` with the full path for an auth file. See [how to create an auth file](https://github.com/Azure/azure-libraries-for-java/blob/master/AUTH.md).
Set the environment variable `AZURE_AUTH_LOCATION` with the full path for an auth file. See [how to create an auth file](https://github.com/Azure/azure-libraries-for-net/blob/master/AUTH.md).

git clone https://github.com/Azure-Samples/compute-dotnet-manage-virtual-machine-scale-sets.git

Expand Down

0 comments on commit d5e125a

Please sign in to comment.