Exemple #1
0
        // Check whether the simulation is running with the conn string in the configuration
        private async Task <bool> IsPreprovisionedIoTHubInUseAsync(IServicesConfig servicesConfig, IIotHubConnectionStringManager connectionStringManager)
        {
            var csInUse  = (await connectionStringManager.GetConnectionStringAsync()).ToLowerInvariant().Trim();
            var csInConf = servicesConfig?.IoTHubConnString?.ToLowerInvariant().Trim();

            return(csInUse == csInConf);
        }
Exemple #2
0
        // If the simulation is running with the conn string in the config then return a URL to the metrics
        private async Task <string> GetIoTHubMetricsUrlAsync(IServicesConfig servicesConfig, IDeploymentConfig deploymentConfig, IIotHubConnectionStringManager connectionStringManager)
        {
            var csInUse  = (await connectionStringManager.GetConnectionStringAsync()).ToLowerInvariant().Trim();
            var csInConf = servicesConfig?.IoTHubConnString?.ToLowerInvariant().Trim();

            // Return the URL only when the simulation is running with the configured conn string
            if (csInUse != csInConf)
            {
                return(string.Empty);
            }

            return($"https://portal.azure.com/{deploymentConfig.AzureSubscriptionDomain}" +
                   $"#resource/subscriptions/{deploymentConfig.AzureSubscriptionId}" +
                   $"/resourceGroups/{deploymentConfig.AzureResourceGroup}" +
                   $"/providers/Microsoft.Devices/IotHubs/{deploymentConfig.AzureIothubName}/Metrics");
        }