|
3 | 3 |
|
4 | 4 | using Microsoft.Azure.Management.AppService.Fluent;
|
5 | 5 | using Microsoft.Azure.Management.AppService.Fluent.Models;
|
6 |
| -using Microsoft.Azure.Management.Batch.Fluent; |
7 | 6 | using Microsoft.Azure.Management.Compute.Fluent;
|
8 | 7 | using Microsoft.Azure.Management.ContainerRegistry.Fluent;
|
9 | 8 | using Microsoft.Azure.Management.ContainerRegistry.Fluent.Models;
|
|
48 | 47 | using Microsoft.Azure.Management.Msi.Fluent;
|
49 | 48 | using Microsoft.Azure.Management.Eventhub.Fluent;
|
50 | 49 | using Microsoft.Azure.Management.Monitor.Fluent;
|
| 50 | +using Microsoft.Azure.Management.PrivateDns.Fluent; |
51 | 51 |
|
52 | 52 | namespace Microsoft.Azure.Management.Samples.Common
|
53 | 53 | {
|
@@ -773,55 +773,6 @@ public static void PrintAvailabilitySet(IAvailabilitySet resource)
|
773 | 773 | .ToString());
|
774 | 774 | }
|
775 | 775 |
|
776 |
| - public static void PrintBatchAccount(IBatchAccount batchAccount) |
777 |
| - { |
778 |
| - var applicationsOutput = new StringBuilder().Append("\n\tapplications: "); |
779 |
| - |
780 |
| - if (batchAccount.Applications.Count > 0) |
781 |
| - { |
782 |
| - foreach (var applicationEntry in batchAccount.Applications) |
783 |
| - { |
784 |
| - var application = applicationEntry.Value; |
785 |
| - var applicationPackages = new StringBuilder().Append("\n\t\t\tapplicationPackages : "); |
786 |
| - |
787 |
| - foreach (var applicationPackageEntry in application.ApplicationPackages) |
788 |
| - { |
789 |
| - var applicationPackage = applicationPackageEntry.Value; |
790 |
| - var singleApplicationPackage = new StringBuilder().Append("\n\t\t\t\tapplicationPackage : " + applicationPackage.Name); |
791 |
| - singleApplicationPackage.Append("\n\t\t\t\tapplicationPackageState : " + applicationPackage.State); |
792 |
| - |
793 |
| - applicationPackages.Append(singleApplicationPackage); |
794 |
| - singleApplicationPackage.Append("\n"); |
795 |
| - } |
796 |
| - |
797 |
| - var singleApplication = new StringBuilder().Append("\n\t\tapplication: " + application.Name); |
798 |
| - singleApplication.Append("\n\t\tdisplayName: " + application.DisplayName); |
799 |
| - singleApplication.Append("\n\t\tdefaultVersion: " + application.DefaultVersion); |
800 |
| - singleApplication.Append(applicationPackages); |
801 |
| - applicationsOutput.Append(singleApplication); |
802 |
| - applicationsOutput.Append("\n"); |
803 |
| - } |
804 |
| - } |
805 |
| - |
806 |
| - Utilities.Log(new StringBuilder().Append("BatchAccount: ").Append(batchAccount.Id) |
807 |
| - .Append("Name: ").Append(batchAccount.Name) |
808 |
| - .Append("\n\tResource group: ").Append(batchAccount.ResourceGroupName) |
809 |
| - .Append("\n\tRegion: ").Append(batchAccount.Region) |
810 |
| - .Append("\n\tTags: ").Append(FormatDictionary(batchAccount.Tags)) |
811 |
| - .Append("\n\tAccountEndpoint: ").Append(batchAccount.AccountEndpoint) |
812 |
| - .Append("\n\tPoolQuota: ").Append(batchAccount.PoolQuota) |
813 |
| - .Append("\n\tActiveJobAndJobScheduleQuota: ").Append(batchAccount.ActiveJobAndJobScheduleQuota) |
814 |
| - .Append("\n\tStorageAccount: ").Append(batchAccount.AutoStorage == null ? "No storage account attached" : batchAccount.AutoStorage.StorageAccountId) |
815 |
| - .Append(applicationsOutput) |
816 |
| - .ToString()); |
817 |
| - } |
818 |
| - |
819 |
| - public static void PrintBatchAccountKey(BatchAccountKeys batchAccountKeys) |
820 |
| - { |
821 |
| - Utilities.Log("Primary Key (" + batchAccountKeys.Primary + ") Secondary key = (" |
822 |
| - + batchAccountKeys.Secondary + ")"); |
823 |
| - } |
824 |
| - |
825 | 776 | public static void PrintNetworkSecurityGroup(INetworkSecurityGroup resource)
|
826 | 777 | {
|
827 | 778 | var nsgOutput = new StringBuilder();
|
@@ -997,6 +948,26 @@ public static void PrintLoadBalancer(ILoadBalancer loadBalancer)
|
997 | 948 | }
|
998 | 949 | }
|
999 | 950 |
|
| 951 | + // Show HTTPS probes |
| 952 | + info.Append("\n\tHTTPS probes: ") |
| 953 | + .Append(loadBalancer.HttpsProbes.Count); |
| 954 | + foreach (var probe in loadBalancer.HttpsProbes.Values) |
| 955 | + { |
| 956 | + info.Append("\n\t\tProbe name: ").Append(probe.Name) |
| 957 | + .Append("\n\t\t\tPort: ").Append(probe.Port) |
| 958 | + .Append("\n\t\t\tInterval in seconds: ").Append(probe.IntervalInSeconds) |
| 959 | + .Append("\n\t\t\tRetries before unhealthy: ").Append(probe.NumberOfProbes) |
| 960 | + .Append("\n\t\t\tHTTPS request path: ").Append(probe.RequestPath); |
| 961 | + |
| 962 | + // Show associated load balancing rules |
| 963 | + info.Append("\n\t\t\tReferenced from load balancing rules: ") |
| 964 | + .Append(probe.LoadBalancingRules.Count); |
| 965 | + foreach (var rule in probe.LoadBalancingRules.Values) |
| 966 | + { |
| 967 | + info.Append("\n\t\t\t\tName: ").Append(rule.Name); |
| 968 | + } |
| 969 | + } |
| 970 | + |
1000 | 971 | // Show load balancing rules
|
1001 | 972 | info.Append("\n\tLoad balancing rules: ")
|
1002 | 973 | .Append(loadBalancer.LoadBalancingRules.Count);
|
@@ -1166,8 +1137,8 @@ public static void PrintVault(IVault vault)
|
1166 | 1137 | foreach (var accessPolicy in vault.AccessPolicies)
|
1167 | 1138 | {
|
1168 | 1139 | info.Append("\n\t\tIdentity:").Append(accessPolicy.ObjectId)
|
1169 |
| - .Append("\n\t\tKey permissions: ").Append(FormatCollection(accessPolicy.Permissions.Keys)) |
1170 |
| - .Append("\n\t\tSecret permissions: ").Append(FormatCollection(accessPolicy.Permissions.Secrets)); |
| 1140 | + .Append("\n\t\tKey permissions: ").Append(FormatCollection(accessPolicy.Permissions.Keys.Select(key => key.ToString()))) |
| 1141 | + .Append("\n\t\tSecret permissions: ").Append(FormatCollection(accessPolicy.Permissions.Secrets.Select(secret => secret.ToString()))); |
1171 | 1142 | }
|
1172 | 1143 |
|
1173 | 1144 | Utilities.Log(info.ToString());
|
@@ -1343,7 +1314,7 @@ public static void PrintSqlServer(ISqlServer sqlServer)
|
1343 | 1314 | Utilities.Log(builder.ToString());
|
1344 | 1315 | }
|
1345 | 1316 |
|
1346 |
| - public static void PrintDatabase(ISqlDatabase database) |
| 1317 | + public static void PrintDatabase(Microsoft.Azure.Management.Sql.Fluent.ISqlDatabase database) |
1347 | 1318 | {
|
1348 | 1319 | var builder = new StringBuilder().Append("Sql Database: ").Append(database.Id)
|
1349 | 1320 | .Append("Name: ").Append(database.Name)
|
@@ -1763,6 +1734,155 @@ public static void Print(IDnsZone dnsZone)
|
1763 | 1734 | Utilities.Log(builder.ToString());
|
1764 | 1735 | }
|
1765 | 1736 |
|
| 1737 | + public static void Print(IPrivateDnsZone privateDnsZone) |
| 1738 | + { |
| 1739 | + var builder = new StringBuilder(); |
| 1740 | + builder.Append("Private Dns Zone: ").Append(privateDnsZone.Id) |
| 1741 | + .Append("\n\tName (Top level domain): ").Append(privateDnsZone.Name) |
| 1742 | + .Append("\n\tResource group: ").Append(privateDnsZone.ResourceGroupName) |
| 1743 | + .Append("\n\tRegion: ").Append(privateDnsZone.RegionName) |
| 1744 | + .Append("\n\tTags: ").Append(privateDnsZone.Tags) |
| 1745 | + .Append("\n\tNumber of record sets: ").Append(privateDnsZone.NumberOfRecordSets) |
| 1746 | + .Append("\n\tMax number of record sets: ").Append(privateDnsZone.MaxNumberOfRecordSets) |
| 1747 | + .Append("\n\tNumber of virtual network links: ").Append(privateDnsZone.NumberOfVirtualNetworkLinks) |
| 1748 | + .Append("\n\tMax number of virtual network links: ").Append(privateDnsZone.NumberOfVirtualNetworkLinks) |
| 1749 | + .Append("\n\tNumber of virtual network links with registration: ").Append(privateDnsZone.NumberOfVirtualNetworkLinksWithRegistration) |
| 1750 | + .Append("\n\tMax number of virtual network links with registration: ").Append(privateDnsZone.MaxNumberOfVirtualNetworkLinksWithRegistration); |
| 1751 | + |
| 1752 | + var aRecordSets = privateDnsZone.ARecordSets.List(); |
| 1753 | + builder.Append("\n\tA Record sets:"); |
| 1754 | + foreach (var aRecordSet in aRecordSets) |
| 1755 | + { |
| 1756 | + builder.Append("\n\t\tId: ").Append(aRecordSet.Id) |
| 1757 | + .Append("\n\t\tName: ").Append(aRecordSet.Name) |
| 1758 | + .Append("\n\t\tTtl (seconds): ").Append(aRecordSet.TimeToLive) |
| 1759 | + .Append("\n\t\tIp v4 addresses: "); |
| 1760 | + foreach (var ipAddress in aRecordSet.IPv4Addresses) |
| 1761 | + { |
| 1762 | + builder.Append("\n\t\t\t").Append(ipAddress); |
| 1763 | + } |
| 1764 | + } |
| 1765 | + |
| 1766 | + var aaaaRecordSets = privateDnsZone.AaaaRecordSets.List(); |
| 1767 | + builder.Append("\n\tAAAA Record sets:"); |
| 1768 | + foreach (var aaaaRecordSet in aaaaRecordSets) |
| 1769 | + { |
| 1770 | + builder.Append("\n\t\tId: ").Append(aaaaRecordSet.Id) |
| 1771 | + .Append("\n\t\tName: ").Append(aaaaRecordSet.Name) |
| 1772 | + .Append("\n\t\tTtl (seconds): ").Append(aaaaRecordSet.TimeToLive) |
| 1773 | + .Append("\n\t\tIp v6 addresses: "); |
| 1774 | + foreach (var ipAddress in aaaaRecordSet.IPv6Addresses) |
| 1775 | + { |
| 1776 | + builder.Append("\n\t\t\t").Append(ipAddress); |
| 1777 | + } |
| 1778 | + } |
| 1779 | + |
| 1780 | + var cnameRecordSets = privateDnsZone.CnameRecordSets.List(); |
| 1781 | + builder.Append("\n\tCNAME Record sets:"); |
| 1782 | + foreach (var cnameRecordSet in cnameRecordSets) |
| 1783 | + { |
| 1784 | + builder.Append("\n\t\tId: ").Append(cnameRecordSet.Id) |
| 1785 | + .Append("\n\t\tName: ").Append(cnameRecordSet.Name) |
| 1786 | + .Append("\n\t\tTtl (seconds): ").Append(cnameRecordSet.TimeToLive) |
| 1787 | + .Append("\n\t\tCanonical name: ").Append(cnameRecordSet.CanonicalName); |
| 1788 | + } |
| 1789 | + |
| 1790 | + var mxRecordSets = privateDnsZone.MxRecordSets.List(); |
| 1791 | + builder.Append("\n\tMX Record sets:"); |
| 1792 | + foreach (var mxRecordSet in mxRecordSets) |
| 1793 | + { |
| 1794 | + builder.Append("\n\t\tId: ").Append(mxRecordSet.Id) |
| 1795 | + .Append("\n\t\tName: ").Append(mxRecordSet.Name) |
| 1796 | + .Append("\n\t\tTtl (seconds): ").Append(mxRecordSet.TimeToLive) |
| 1797 | + .Append("\n\t\tRecords: "); |
| 1798 | + foreach (var mxRecord in mxRecordSet.Records) |
| 1799 | + { |
| 1800 | + builder.Append("\n\t\t\tExchange server, Preference: ") |
| 1801 | + .Append(mxRecord.Exchange) |
| 1802 | + .Append(" ") |
| 1803 | + .Append(mxRecord.Preference); |
| 1804 | + } |
| 1805 | + } |
| 1806 | + |
| 1807 | + var ptrRecordSets = privateDnsZone.PtrRecordSets.List(); |
| 1808 | + builder.Append("\n\tPTR Record sets:"); |
| 1809 | + foreach (var ptrRecordSet in ptrRecordSets) |
| 1810 | + { |
| 1811 | + builder.Append("\n\t\tId: ").Append(ptrRecordSet.Id) |
| 1812 | + .Append("\n\t\tName: ").Append(ptrRecordSet.Name) |
| 1813 | + .Append("\n\t\tTtl (seconds): ").Append(ptrRecordSet.TimeToLive) |
| 1814 | + .Append("\n\t\tTarget domain names: "); |
| 1815 | + foreach (var domainNames in ptrRecordSet.TargetDomainNames) |
| 1816 | + { |
| 1817 | + builder.Append("\n\t\t\t").Append(domainNames); |
| 1818 | + } |
| 1819 | + } |
| 1820 | + |
| 1821 | + var soaRecordSets = privateDnsZone.SoaRecordSets.List(); |
| 1822 | + builder.Append("\n\tSOA Record sets:"); |
| 1823 | + foreach (var soaRecordSet in soaRecordSets) |
| 1824 | + { |
| 1825 | + var soaRecord = soaRecordSet.Record; |
| 1826 | + builder.Append("\n\tSOA Record:") |
| 1827 | + .Append("\n\t\tHost:").Append(soaRecord.Host) |
| 1828 | + .Append("\n\t\tEmail:").Append(soaRecord.Email) |
| 1829 | + .Append("\n\t\tExpire time (seconds):").Append(soaRecord.ExpireTime) |
| 1830 | + .Append("\n\t\tRefresh time (seconds):").Append(soaRecord.RefreshTime) |
| 1831 | + .Append("\n\t\tRetry time (seconds):").Append(soaRecord.RetryTime) |
| 1832 | + .Append("\n\t\tNegative response cache ttl (seconds):").Append(soaRecord.MinimumTtl) |
| 1833 | + .Append("\n\t\tTtl (seconds):").Append(soaRecordSet.TimeToLive); |
| 1834 | + } |
| 1835 | + |
| 1836 | + var srvRecordSets = privateDnsZone.SrvRecordSets.List(); |
| 1837 | + builder.Append("\n\tSRV Record sets:"); |
| 1838 | + foreach (var srvRecordSet in srvRecordSets) |
| 1839 | + { |
| 1840 | + builder.Append("\n\t\tId: ").Append(srvRecordSet.Id) |
| 1841 | + .Append("\n\t\tName: ").Append(srvRecordSet.Name) |
| 1842 | + .Append("\n\t\tTtl (seconds): ").Append(srvRecordSet.TimeToLive) |
| 1843 | + .Append("\n\t\tRecords: "); |
| 1844 | + foreach (var srvRecord in srvRecordSet.Records) |
| 1845 | + { |
| 1846 | + builder.Append("\n\t\t\tTarget, Port, Priority, Weight: ") |
| 1847 | + .Append(srvRecord.Target) |
| 1848 | + .Append(", ") |
| 1849 | + .Append(srvRecord.Port) |
| 1850 | + .Append(", ") |
| 1851 | + .Append(srvRecord.Priority) |
| 1852 | + .Append(", ") |
| 1853 | + .Append(srvRecord.Weight); |
| 1854 | + } |
| 1855 | + } |
| 1856 | + |
| 1857 | + var txtRecordSets = privateDnsZone.TxtRecordSets.List(); |
| 1858 | + builder.Append("\n\tTXT Record sets:"); |
| 1859 | + foreach (var txtRecordSet in txtRecordSets) |
| 1860 | + { |
| 1861 | + builder.Append("\n\t\tId: ").Append(txtRecordSet.Id) |
| 1862 | + .Append("\n\t\tName: ").Append(txtRecordSet.Name) |
| 1863 | + .Append("\n\t\tTtl (seconds): ").Append(txtRecordSet.TimeToLive) |
| 1864 | + .Append("\n\t\tRecords: "); |
| 1865 | + foreach (var txtRecord in txtRecordSet.Records) |
| 1866 | + { |
| 1867 | + if (txtRecord.Value.Count() > 0) |
| 1868 | + { |
| 1869 | + builder.Append("\n\t\t\tValue: ").Append(txtRecord.Value.FirstOrDefault()); |
| 1870 | + } |
| 1871 | + } |
| 1872 | + } |
| 1873 | + |
| 1874 | + var virtualNetworkLinks = privateDnsZone.VirtualNetworkLinks.List(); |
| 1875 | + builder.Append("\n\tVirtual network links:"); |
| 1876 | + foreach (var virtualNetworkLink in virtualNetworkLinks) |
| 1877 | + { |
| 1878 | + builder.Append("\n\t\tId: ").Append(virtualNetworkLink.Id) |
| 1879 | + .Append("\n\t\tName: ").Append(virtualNetworkLink.Name) |
| 1880 | + .Append("\n\t\tReference of virtual network: ").Append(virtualNetworkLink.ReferencedVirtualNetworkId) |
| 1881 | + .Append("\n\t\tRegistration enabled: ").Append(virtualNetworkLink.IsAutoRegistrationEnabled); |
| 1882 | + } |
| 1883 | + Utilities.Log(builder.ToString()); |
| 1884 | + } |
| 1885 | + |
1766 | 1886 | public static void Print(IRegistry azureRegistry)
|
1767 | 1887 | {
|
1768 | 1888 | StringBuilder info = new StringBuilder();
|
@@ -2648,7 +2768,15 @@ public static void CreateCertificate(string domainName, string pfxPath, string p
|
2648 | 2768 | ProcessStartInfo info = new ProcessStartInfo("powershell", args);
|
2649 | 2769 | string assetPath = Path.Combine(ProjectPath, "Asset");
|
2650 | 2770 | info.WorkingDirectory = assetPath;
|
2651 |
| - Process.Start(info).WaitForExit(); |
| 2771 | + Process process = Process.Start(info); |
| 2772 | + process.WaitForExit(); |
| 2773 | + |
| 2774 | + if (process.ExitCode != 0) |
| 2775 | + { |
| 2776 | + // call "Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass" in powershell if you fail here |
| 2777 | + |
| 2778 | + Utilities.Log("powershell createCert.ps1 script failed"); |
| 2779 | + } |
2652 | 2780 | }
|
2653 | 2781 | else
|
2654 | 2782 | {
|
|
0 commit comments