private static void Demo_Jobs_GetJobUrl(AdlClient.AnalyticsClient adla)
        {
            var listing_parameters = new AdlClient.Models.JobListingParameters();

            listing_parameters.Top = 3;
            var jobs = adla.Jobs.ListJobs(listing_parameters).ToList();

            foreach (var job in jobs)
            {
                var job_ref = job.GetJobReference();

                var job_uri        = new JobUri(job_ref);
                var job_portal_uri = new JobAzurePortalUri(job_ref);

                Console.WriteLine(job_uri.ToString());
                Console.WriteLine(job_portal_uri.ToString());
            }
        }
        public static JobAzurePortalUri Parse(string s)
        {
            var uri = new System.Uri(s);

            var adl_portal_authority = "portal.azure.com";

            if (uri.Authority.ToLower() != adl_portal_authority)
            {
                string msg = string.Format("Malformed job portal uri: Uri.Authority must be with \"{0}\"", adl_portal_authority);
                throw new System.ArgumentException(msg);
            }

            string fragment = uri.Fragment;

            string fragment_prefix = "#blade/Microsoft_Azure_DataLakeAnalytics/SqlIpJobDetailsBlade/accountId/";

            if (!fragment.StartsWith(fragment_prefix))
            {
                throw new System.ArgumentException("invalid uri fragment");
            }

            var fragment_remainder = fragment.Substring(fragment_prefix.Length);

            fragment_remainder = System.Uri.UnescapeDataString(fragment_remainder);

            var fragment_tokens = fragment_remainder.Split('/');

            // Basic fragment validation

            if (fragment_tokens.Length < 11)
            {
                throw new System.ArgumentException("Malformed job portal uri: has Fragment has less than 11 parts");
            }

            if (fragment_tokens[0] != "")
            {
                throw new System.ArgumentException("Malformed job portal uri: first token should be empty");
            }

            // Subscription
            if (fragment_tokens[1] != "subscriptions")
            {
                throw new System.ArgumentException(
                          "Malformed job portal uri: missing \"subscriptions\" in Fragment at position 1");
            }
            var subid = fragment_tokens[2];

            // Resource Group
            if (fragment_tokens[3] != "resourcegroups")
            {
                throw new System.ArgumentException(
                          "Malformed job portal uri: missing \"resourcegroups\" in Fragment at position 3");
            }

            // Provider
            var rg = fragment_tokens[4];

            if (fragment_tokens[5] != "providers")
            {
                throw new System.ArgumentException(
                          "Malformed job portal uri: missing \"providers\" in Fragment at position 5");
            }

            if (fragment_tokens[6] != "Microsoft.DataLakeAnalytics")
            {
                throw new System.ArgumentException(
                          "Malformed job portal uri: missing \"Microsoft.DataLakeAnalytics\" in Fragment at position 6");
            }

            // ADLA Account
            if (fragment_tokens[7] != "accounts")
            {
                throw new System.ArgumentException(
                          "Malformed job portal uri: missing \"accounts\" in Fragment at position 7");
            }

            var account_name = fragment_tokens[8];

            // JobId
            if (fragment_tokens[9] != "jobId")
            {
                throw new System.ArgumentException(
                          "Malformed job portal uri: missing \"jobid\" in Fragment at position 9");
            }

            var jobid_str = fragment_tokens[10];
            var jobid     = System.Guid.Parse(jobid_str);

            // Final URI
            var job_portal_uri = new JobAzurePortalUri(subid, rg, account_name, jobid);

            return(job_portal_uri);
        }