// Check whether the simulation is running with the conn string in the configuration private bool IsPreprovisionedIoTHubInUse(IServicesConfig servicesConfig, IIotHubConnectionStringManager connectionStringManager) { var csInUse = connectionStringManager.GetIotHubConnectionString().ToLowerInvariant().Trim(); var csInConf = servicesConfig?.IoTHubConnString?.ToLowerInvariant().Trim(); return(csInUse == csInConf); }
// If the simulation is running with the conn string in the config then return a URL to the metrics private string GetIoTHubMetricsUrl(IServicesConfig servicesConfig, IDeploymentConfig deploymentConfig, IIotHubConnectionStringManager connectionStringManager) { var csInUse = connectionStringManager.GetIotHubConnectionString().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"); }