mattmcnabb / O365ServiceCommunications

A Powershell module for monitoringOffice 365 Service Health!
25 stars 6 forks source link

API Issue - error "Not running in a hosted service or the Development Fabric." #4

Closed flamant666 closed 7 years ago

flamant666 commented 7 years ago

Since yesterday night I have start seeing issues while using your module to connect to Office 365 and retrieve Events through "Get-SCEvent". It throws that long error below. Thanks for your help.

Invoke-RestMethod :

    Not running in a hosted service or the Development Fabric.

     body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
     p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
     b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
     H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
     H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
     pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
     .marker {font-weight: bold; color: black;text-decoration: none;}
     .version {color: gray;}
     .error {margin-bottom: 10px;}
     .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
     @media screen and (max-width: 639px) {
      pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
     }
     @media screen and (max-width: 479px) {
      pre { width: 280px; }
     }

        Server Error in '/' Application.
         Not running in a hosted service or the Development Fabric. 

         Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it 

originated in the code.

         Exception Details: System.InvalidOperationException: Not running in a hosted service or the Development Fabric.
        Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

        Stack Trace: 

[InvalidOperationException: Not running in a hosted service or the Development Fabric.] Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +684 Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +34 [ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.] System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +8820659 System.Diagnostics.TypedElement.BaseGetRuntimeObject() +106 System.Diagnostics.ListenerElement.GetRuntimeObject() +921 System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +252 System.Diagnostics.TraceInternal.get_Listeners() +331 System.Diagnostics.TraceInternal.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args) +265 [TypeInitializationException: The type initializer for 'Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext' threw an exception.] Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext..ctor(String authority, TokenCache tokenCache) +0 Internal.OSSInfra.Common.Azure.<GetAccessToken>d0.MoveNext() in e:\Houston\QLocal\cmd\4\sources\dev\common\src\Azure\AzureKeyVaultFactory.cs:49 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84 Microsoft.Azure.KeyVault.<PostAuthenticate>d4.MoveNext() +897 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84 System.Runtime.CompilerServices.ConfiguredTaskAwaiter.GetResult() +49 Microsoft.Azure.KeyVault.<ProcessHttpRequestAsync>d9.MoveNext() +2057 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84 Microsoft.Azure.KeyVault.Internal.<GetAsync>df.MoveNext() +1793 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84 Microsoft.Azure.KeyVault.<<GetSecretAsync>bc4>dc7.MoveNext() +539 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84 Microsoft.Azure.KeyVault.<Do>d11b`1.MoveNext() +722 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84 Microsoft.Azure.KeyVault.<GetSecretAsync>dcb.MoveNext() +763 [AggregateException: One or more errors occurred.] System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) +5865996 Internal.OSSInfra.Common.Azure.AzureKeyVault.GetSecret(String secretUri) in e:\Houston\QLocal\cmd\4\sources\dev\common\src\Azure\AzureKeyVault.cs:42 Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusSettings.GetKeyVaultSecret(IKeyVault keyVault, String settingName) in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusSettings.cs:843 [ConfigurationErrorsException: Error retrieving ExpansionConnectionStringMappingSecretUri secret] Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusSettings.GetKeyVaultSecret(IKeyVault keyVault, String settingName) in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusSettings.cs:849 Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusSettings.LoadConfigSettings() in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusSettings.cs:642 Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper..cctor() in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusHelper.cs:301 [TypeInitializationException: The type initializer for 'Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper' threw an exception.] Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper.LoadIncidentCache() in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusHelper.cs:517 Microsoft.Exchange.ServiceStatus.TenantCommunications.Web.Global.Application_Start(Object sender, EventArgs e) in e:\Houston\QLocal\cmd\7\sources\dev\ServiceHealthDashboard\src\SHDAccess\Service\TenantCommunications\TenantCommunicationsWebRole\Global.asax.cs:69 [HttpException (0x80004005): The type initializer for 'Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper' threw an exception.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12625917 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +353 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475 [HttpException (0x80004005): The type initializer for 'Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper' threw an exception.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12642964 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12482369

        Version Information:&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:0.0.0.0

d0.MoveNext() in e:\Houston\QLocal\cmd\4\sources\dev\common\src\Azure\AzureKeyVaultFactory.cs:line 49 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.KeyVault.KeyVaultCredential.d4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Microsoft.Azure.KeyVault.KeyVaultCredential.d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.KeyVault.Internal.SecretOperations.d__f.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.KeyVault.KeyVaultClient.c__DisplayClassc5.b__c4>d__c7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.KeyVault.KeyVaultClient.d__11b1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.KeyVault.KeyVaultClient.d__cb.MoveNext() [AggregateException]: One or more errors occurred. at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at Internal.OSSInfra.Common.Azure.AzureKeyVault.GetSecret(String secretUri) in e:\Houston\QLocal\cmd\4\sources\dev\common\src\Azure\AzureKeyVault.cs:line 42 at Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusSettings.GetKeyVaultSecret(IKeyVault keyVault, String settingName) in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusSettings.cs:line 843 [ConfigurationErrorsException]: Error retrieving ExpansionConnectionStringMappingSecretUri secret at Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusSettings.GetKeyVaultSecret(IKeyVault keyVault, String settingName) in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusSettings.cs:line 849 at Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusSettings.LoadConfigSettings() in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusSettings.cs:line 642 at Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper..cctor() in e:\Houston\QLocal\cmd\2\sources\dev\ServiceHealthDashboard\src\HealthStatus\HealthStatusWebService\Code\HealthStatusHelper.cs:line 301 [TypeInitializationException]: The type initializer for 'Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper' threw an exception. at Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper.LoadIncidentCache() at Microsoft.Exchange.ServiceStatus.TenantCommunications.Web.Global.Application_Start(Object sender, EventArgs e) in e:\Houston\QLocal\cmd\7\sources\dev\ServiceHealthDashboard\src\SHDAccess\Service\TenantCommunications\TenantCommunicationsWebRole\Global.asax.cs:line 69 [HttpException]: The type initializer for 'Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper' threw an exception. at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) [HttpException]: The type initializer for 'Microsoft.Exchange.ServiceStatus.HealthStatus.HealthStatusHelper' threw an exception. at System.Web.HttpRuntime.FirstRequestInit(HttpContext context) at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) --> At C:\Users\oraynaut\Downloads\O365ServiceCommunications-master\O365ServiceCommunications\functions\New-SCSession.ps1:60 char:22

mattmcnabb commented 7 years ago

thanks for posting the issue. I can't reproduce this at the moment, and it looks like there is a problem with the web service itself. I'll see if I can ping someone who would know something about this particular issue.

Are you an Office 365 global admin, or are you accessing this as an Office 365 partner?

flamant666 commented 7 years ago

Hi Matt,

I'm a global admin and also an Office 365 partner. We use your module to retrieve the status programmatically and it has worked great so far!

flamant666 commented 7 years ago

Actually it is working again. This must have been something on Microsoft side then. Thanks though, and thank you for this module!

mattmcnabb commented 7 years ago

you're welcome! I'm glad it's useful to you! I'll close this issue, but let me know if this becomes a chronic problem. They've been telling us that this API will be deprecated in favor of a new one, but haven't officially announced any dates around that yet.