Skip to content

Commit

Permalink
Release 1.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Azure-Fluent committed Jan 14, 2020
1 parent 42aa3dc commit 7add872
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 83 deletions.
17 changes: 0 additions & 17 deletions Asset/NetworkTestCertificate1.cer

This file was deleted.

2 changes: 2 additions & 0 deletions Asset/install_apache.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

sudo apt-get install -f

sudo apt-get update

# install apache
Expand Down
236 changes: 182 additions & 54 deletions Common/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using Microsoft.Azure.Management.AppService.Fluent;
using Microsoft.Azure.Management.AppService.Fluent.Models;
using Microsoft.Azure.Management.Batch.Fluent;
using Microsoft.Azure.Management.Compute.Fluent;
using Microsoft.Azure.Management.ContainerRegistry.Fluent;
using Microsoft.Azure.Management.ContainerRegistry.Fluent.Models;
Expand Down Expand Up @@ -48,6 +47,7 @@
using Microsoft.Azure.Management.Msi.Fluent;
using Microsoft.Azure.Management.Eventhub.Fluent;
using Microsoft.Azure.Management.Monitor.Fluent;
using Microsoft.Azure.Management.PrivateDns.Fluent;

namespace Microsoft.Azure.Management.Samples.Common
{
Expand Down Expand Up @@ -773,55 +773,6 @@ public static void PrintAvailabilitySet(IAvailabilitySet resource)
.ToString());
}

public static void PrintBatchAccount(IBatchAccount batchAccount)
{
var applicationsOutput = new StringBuilder().Append("\n\tapplications: ");

if (batchAccount.Applications.Count > 0)
{
foreach (var applicationEntry in batchAccount.Applications)
{
var application = applicationEntry.Value;
var applicationPackages = new StringBuilder().Append("\n\t\t\tapplicationPackages : ");

foreach (var applicationPackageEntry in application.ApplicationPackages)
{
var applicationPackage = applicationPackageEntry.Value;
var singleApplicationPackage = new StringBuilder().Append("\n\t\t\t\tapplicationPackage : " + applicationPackage.Name);
singleApplicationPackage.Append("\n\t\t\t\tapplicationPackageState : " + applicationPackage.State);

applicationPackages.Append(singleApplicationPackage);
singleApplicationPackage.Append("\n");
}

var singleApplication = new StringBuilder().Append("\n\t\tapplication: " + application.Name);
singleApplication.Append("\n\t\tdisplayName: " + application.DisplayName);
singleApplication.Append("\n\t\tdefaultVersion: " + application.DefaultVersion);
singleApplication.Append(applicationPackages);
applicationsOutput.Append(singleApplication);
applicationsOutput.Append("\n");
}
}

Utilities.Log(new StringBuilder().Append("BatchAccount: ").Append(batchAccount.Id)
.Append("Name: ").Append(batchAccount.Name)
.Append("\n\tResource group: ").Append(batchAccount.ResourceGroupName)
.Append("\n\tRegion: ").Append(batchAccount.Region)
.Append("\n\tTags: ").Append(FormatDictionary(batchAccount.Tags))
.Append("\n\tAccountEndpoint: ").Append(batchAccount.AccountEndpoint)
.Append("\n\tPoolQuota: ").Append(batchAccount.PoolQuota)
.Append("\n\tActiveJobAndJobScheduleQuota: ").Append(batchAccount.ActiveJobAndJobScheduleQuota)
.Append("\n\tStorageAccount: ").Append(batchAccount.AutoStorage == null ? "No storage account attached" : batchAccount.AutoStorage.StorageAccountId)
.Append(applicationsOutput)
.ToString());
}

public static void PrintBatchAccountKey(BatchAccountKeys batchAccountKeys)
{
Utilities.Log("Primary Key (" + batchAccountKeys.Primary + ") Secondary key = ("
+ batchAccountKeys.Secondary + ")");
}

public static void PrintNetworkSecurityGroup(INetworkSecurityGroup resource)
{
var nsgOutput = new StringBuilder();
Expand Down Expand Up @@ -997,6 +948,26 @@ public static void PrintLoadBalancer(ILoadBalancer loadBalancer)
}
}

// Show HTTPS probes
info.Append("\n\tHTTPS probes: ")
.Append(loadBalancer.HttpsProbes.Count);
foreach (var probe in loadBalancer.HttpsProbes.Values)
{
info.Append("\n\t\tProbe name: ").Append(probe.Name)
.Append("\n\t\t\tPort: ").Append(probe.Port)
.Append("\n\t\t\tInterval in seconds: ").Append(probe.IntervalInSeconds)
.Append("\n\t\t\tRetries before unhealthy: ").Append(probe.NumberOfProbes)
.Append("\n\t\t\tHTTPS request path: ").Append(probe.RequestPath);

// Show associated load balancing rules
info.Append("\n\t\t\tReferenced from load balancing rules: ")
.Append(probe.LoadBalancingRules.Count);
foreach (var rule in probe.LoadBalancingRules.Values)
{
info.Append("\n\t\t\t\tName: ").Append(rule.Name);
}
}

// Show load balancing rules
info.Append("\n\tLoad balancing rules: ")
.Append(loadBalancer.LoadBalancingRules.Count);
Expand Down Expand Up @@ -1166,8 +1137,8 @@ public static void PrintVault(IVault vault)
foreach (var accessPolicy in vault.AccessPolicies)
{
info.Append("\n\t\tIdentity:").Append(accessPolicy.ObjectId)
.Append("\n\t\tKey permissions: ").Append(FormatCollection(accessPolicy.Permissions.Keys))
.Append("\n\t\tSecret permissions: ").Append(FormatCollection(accessPolicy.Permissions.Secrets));
.Append("\n\t\tKey permissions: ").Append(FormatCollection(accessPolicy.Permissions.Keys.Select(key => key.ToString())))
.Append("\n\t\tSecret permissions: ").Append(FormatCollection(accessPolicy.Permissions.Secrets.Select(secret => secret.ToString())));
}

Utilities.Log(info.ToString());
Expand Down Expand Up @@ -1343,7 +1314,7 @@ public static void PrintSqlServer(ISqlServer sqlServer)
Utilities.Log(builder.ToString());
}

public static void PrintDatabase(ISqlDatabase database)
public static void PrintDatabase(Microsoft.Azure.Management.Sql.Fluent.ISqlDatabase database)
{
var builder = new StringBuilder().Append("Sql Database: ").Append(database.Id)
.Append("Name: ").Append(database.Name)
Expand Down Expand Up @@ -1763,6 +1734,155 @@ public static void Print(IDnsZone dnsZone)
Utilities.Log(builder.ToString());
}

public static void Print(IPrivateDnsZone privateDnsZone)
{
var builder = new StringBuilder();
builder.Append("Private Dns Zone: ").Append(privateDnsZone.Id)
.Append("\n\tName (Top level domain): ").Append(privateDnsZone.Name)
.Append("\n\tResource group: ").Append(privateDnsZone.ResourceGroupName)
.Append("\n\tRegion: ").Append(privateDnsZone.RegionName)
.Append("\n\tTags: ").Append(privateDnsZone.Tags)
.Append("\n\tNumber of record sets: ").Append(privateDnsZone.NumberOfRecordSets)
.Append("\n\tMax number of record sets: ").Append(privateDnsZone.MaxNumberOfRecordSets)
.Append("\n\tNumber of virtual network links: ").Append(privateDnsZone.NumberOfVirtualNetworkLinks)
.Append("\n\tMax number of virtual network links: ").Append(privateDnsZone.NumberOfVirtualNetworkLinks)
.Append("\n\tNumber of virtual network links with registration: ").Append(privateDnsZone.NumberOfVirtualNetworkLinksWithRegistration)
.Append("\n\tMax number of virtual network links with registration: ").Append(privateDnsZone.MaxNumberOfVirtualNetworkLinksWithRegistration);

var aRecordSets = privateDnsZone.ARecordSets.List();
builder.Append("\n\tA Record sets:");
foreach (var aRecordSet in aRecordSets)
{
builder.Append("\n\t\tId: ").Append(aRecordSet.Id)
.Append("\n\t\tName: ").Append(aRecordSet.Name)
.Append("\n\t\tTtl (seconds): ").Append(aRecordSet.TimeToLive)
.Append("\n\t\tIp v4 addresses: ");
foreach (var ipAddress in aRecordSet.IPv4Addresses)
{
builder.Append("\n\t\t\t").Append(ipAddress);
}
}

var aaaaRecordSets = privateDnsZone.AaaaRecordSets.List();
builder.Append("\n\tAAAA Record sets:");
foreach (var aaaaRecordSet in aaaaRecordSets)
{
builder.Append("\n\t\tId: ").Append(aaaaRecordSet.Id)
.Append("\n\t\tName: ").Append(aaaaRecordSet.Name)
.Append("\n\t\tTtl (seconds): ").Append(aaaaRecordSet.TimeToLive)
.Append("\n\t\tIp v6 addresses: ");
foreach (var ipAddress in aaaaRecordSet.IPv6Addresses)
{
builder.Append("\n\t\t\t").Append(ipAddress);
}
}

var cnameRecordSets = privateDnsZone.CnameRecordSets.List();
builder.Append("\n\tCNAME Record sets:");
foreach (var cnameRecordSet in cnameRecordSets)
{
builder.Append("\n\t\tId: ").Append(cnameRecordSet.Id)
.Append("\n\t\tName: ").Append(cnameRecordSet.Name)
.Append("\n\t\tTtl (seconds): ").Append(cnameRecordSet.TimeToLive)
.Append("\n\t\tCanonical name: ").Append(cnameRecordSet.CanonicalName);
}

var mxRecordSets = privateDnsZone.MxRecordSets.List();
builder.Append("\n\tMX Record sets:");
foreach (var mxRecordSet in mxRecordSets)
{
builder.Append("\n\t\tId: ").Append(mxRecordSet.Id)
.Append("\n\t\tName: ").Append(mxRecordSet.Name)
.Append("\n\t\tTtl (seconds): ").Append(mxRecordSet.TimeToLive)
.Append("\n\t\tRecords: ");
foreach (var mxRecord in mxRecordSet.Records)
{
builder.Append("\n\t\t\tExchange server, Preference: ")
.Append(mxRecord.Exchange)
.Append(" ")
.Append(mxRecord.Preference);
}
}

var ptrRecordSets = privateDnsZone.PtrRecordSets.List();
builder.Append("\n\tPTR Record sets:");
foreach (var ptrRecordSet in ptrRecordSets)
{
builder.Append("\n\t\tId: ").Append(ptrRecordSet.Id)
.Append("\n\t\tName: ").Append(ptrRecordSet.Name)
.Append("\n\t\tTtl (seconds): ").Append(ptrRecordSet.TimeToLive)
.Append("\n\t\tTarget domain names: ");
foreach (var domainNames in ptrRecordSet.TargetDomainNames)
{
builder.Append("\n\t\t\t").Append(domainNames);
}
}

var soaRecordSets = privateDnsZone.SoaRecordSets.List();
builder.Append("\n\tSOA Record sets:");
foreach (var soaRecordSet in soaRecordSets)
{
var soaRecord = soaRecordSet.Record;
builder.Append("\n\tSOA Record:")
.Append("\n\t\tHost:").Append(soaRecord.Host)
.Append("\n\t\tEmail:").Append(soaRecord.Email)
.Append("\n\t\tExpire time (seconds):").Append(soaRecord.ExpireTime)
.Append("\n\t\tRefresh time (seconds):").Append(soaRecord.RefreshTime)
.Append("\n\t\tRetry time (seconds):").Append(soaRecord.RetryTime)
.Append("\n\t\tNegative response cache ttl (seconds):").Append(soaRecord.MinimumTtl)
.Append("\n\t\tTtl (seconds):").Append(soaRecordSet.TimeToLive);
}

var srvRecordSets = privateDnsZone.SrvRecordSets.List();
builder.Append("\n\tSRV Record sets:");
foreach (var srvRecordSet in srvRecordSets)
{
builder.Append("\n\t\tId: ").Append(srvRecordSet.Id)
.Append("\n\t\tName: ").Append(srvRecordSet.Name)
.Append("\n\t\tTtl (seconds): ").Append(srvRecordSet.TimeToLive)
.Append("\n\t\tRecords: ");
foreach (var srvRecord in srvRecordSet.Records)
{
builder.Append("\n\t\t\tTarget, Port, Priority, Weight: ")
.Append(srvRecord.Target)
.Append(", ")
.Append(srvRecord.Port)
.Append(", ")
.Append(srvRecord.Priority)
.Append(", ")
.Append(srvRecord.Weight);
}
}

var txtRecordSets = privateDnsZone.TxtRecordSets.List();
builder.Append("\n\tTXT Record sets:");
foreach (var txtRecordSet in txtRecordSets)
{
builder.Append("\n\t\tId: ").Append(txtRecordSet.Id)
.Append("\n\t\tName: ").Append(txtRecordSet.Name)
.Append("\n\t\tTtl (seconds): ").Append(txtRecordSet.TimeToLive)
.Append("\n\t\tRecords: ");
foreach (var txtRecord in txtRecordSet.Records)
{
if (txtRecord.Value.Count() > 0)
{
builder.Append("\n\t\t\tValue: ").Append(txtRecord.Value.FirstOrDefault());
}
}
}

var virtualNetworkLinks = privateDnsZone.VirtualNetworkLinks.List();
builder.Append("\n\tVirtual network links:");
foreach (var virtualNetworkLink in virtualNetworkLinks)
{
builder.Append("\n\t\tId: ").Append(virtualNetworkLink.Id)
.Append("\n\t\tName: ").Append(virtualNetworkLink.Name)
.Append("\n\t\tReference of virtual network: ").Append(virtualNetworkLink.ReferencedVirtualNetworkId)
.Append("\n\t\tRegistration enabled: ").Append(virtualNetworkLink.IsAutoRegistrationEnabled);
}
Utilities.Log(builder.ToString());
}

public static void Print(IRegistry azureRegistry)
{
StringBuilder info = new StringBuilder();
Expand Down Expand Up @@ -2648,7 +2768,15 @@ public static void CreateCertificate(string domainName, string pfxPath, string p
ProcessStartInfo info = new ProcessStartInfo("powershell", args);
string assetPath = Path.Combine(ProjectPath, "Asset");
info.WorkingDirectory = assetPath;
Process.Start(info).WaitForExit();
Process process = Process.Start(info);
process.WaitForExit();

if (process.ExitCode != 0)
{
// call "Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass" in powershell if you fail here

Utilities.Log("powershell createCert.ps1 script failed");
}
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions ManageSqlDatabase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.18" />
<PackageReference Include="Microsoft.Azure.Management.Fluent" Version="1.24.0" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.19" />
<PackageReference Include="Microsoft.Azure.Management.Fluent" Version="1.30.0" />
<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" />
<PackageReference Include="Docker.DotNet" Version="2.124.3" />
<PackageReference Include="Docker.DotNet.X509" Version="2.124.3" />
<PackageReference Include="WindowsAzure.Storage" Version="8.1.4" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.3" />
</ItemGroup>

Expand Down
3 changes: 2 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public static void RunSample(IAzure azure)
// Update the edition of database.
Utilities.Log("Updating a database");
database = database.Update()
.WithEdition(DatabaseEditions.Standard)
.WithEdition(DatabaseEdition.Standard)
.WithServiceObjective(ServiceObjectiveName.S1)
.WithMaxSizeBytes((long)Microsoft.Azure.Management.Sql.Fluent.SqlDatabaseStandardStorage.Max250Gb)
.Apply();
Utilities.PrintDatabase(database);

Expand Down
Loading

0 comments on commit 7add872

Please sign in to comment.