Use-AzureHDInsightCluster throws error - powershell

I'm trying to use the Use-AzureHDInsightCluster powershell cmdlet
Use-AzureHDInsightCluster "mycluster" -Subscription (Get-AzureSubscription -Current).SubscriptionId
but I get the following error. Not sure where to start as I'm new to this.
Use-AzureHDInsightCluster : An error occurred while sending the request.
At line:1 char:1
+ Use-AzureHDInsightCluster "mycluster" -Subscription (Get-AzureSubscription -Cu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Use-AzureHDInsightCluster], HttpRequestException
+ FullyQualifiedErrorId : System.Net.Http.HttpRequestException,Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.
PSCmdlets.UseAzureHDInsightClusterCmdlet
EDIT I've added the debug flag and I get a little more information
DEBUG: Severity: Error
One or more errors occurred.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.PSCmdlets.UseAzureHDInsightClusterCmdlet.EndProcessing()
An error occurred while sending the request.
at System.Threading.Tasks.TaskAwaiter`1.GetResult()
at
Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.Commands.CommandImplementations.UseAzureHDInsightClusterCommand.<End
Processing>d__0.MoveNext()
Unable to connect to the remote server
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
An attempt was made to access a socket in a way forbidden by its access permissions 70.37.71.239:8443
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket,
IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

Remove WindowsAzureProfile.xml from below folder and try again:
C:\Users\xxxx\AppData\Roaming\Windows Azure Powershell

The error message is not very helpful, isn't it. PowerShell has some common switches. Two of them are helpful for debugging. They are -debug and -verbose. Retry the command with the two switch and get the detailed information.
Is "mycluster" a valid cluster name? Is it a name you used for this post? Can you test the Windows Azure connection using the following commands:
Get-AzureSubscription
Get-AzureHDInsightCluster
If you don't receive your subscriptions nor your cluster list. You might need to fix your connection first. For information on connecting to your Azure account, see http://www.windowsazure.com/en-us/manage/install-and-configure-windows-powershell/.

Related

Error connecting to Sharepoint site from Powershell

Since a few days back I started receiving the below error when I try to connect to Sharepoint site.
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
As per the documentation below I tried making the registry changes below and ran below Powershell command, restarted the server but still receiving the same error. Has anything changed recently?
https://learn.microsoft.com/en-us/sharepoint/troubleshoot/administration/authentication-errors-tls12-support
https://learn.microsoft.com/en-us/mem/configmgr/core/plan-design/security/enable-tls-1-2-client#configure-for-strong-cryptography
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions" = dword:00000001
"SchUseStrongCrypto" = dword:00000001
Enable-TlsCipherSuite -Name "TLS_DHE_DSS_WITH_AES_256_CBC_SHA"
Try adding below line of code before connecting to SharePoint Site:
PowerShell
[System.Net.ServicePointManager]::SecurityProtocol =
[System.Net.SecurityProtocolType]::Tls12;
.NET
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
This should work for you.
Update:
Added PowerShell equivalent code.

Service Fabric becomes unavailable after update to latest (6.1.456.9494)

I have two main symptoms of a larger problem.
If I'm debugging an application in visual studio every once in a while I'll have it on a breakpoint and the service will just close. Here is the log when it "crashes"
WARNING: Failed to contact Naming Service. Attempting to contact Failover Manager Service...
WARNING: Failed to contact Failover Manager Service, Attempting to contact FMM...
WARNING: Failed to contact Failover Manager Service, Attempting to contact FMM...
Connect-ServiceFabricCluster : Could not ping any of the provided Service Fabric gateway endpoints.
At line:1 char:8
+ [void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricTransientException
+ FullyQualifiedErrorId : TestClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
WARNING: Unable to Verify connection to Service Fabric cluster.
Test-ServiceFabricClusterConnection : Cluster connection instance is null
At C:\Program Files\Microsoft SDKs\Service
Fabric\Tools\PSModule\ServiceFabricSDK\Get-ServiceFabricApplicationStatus.ps1:27 char:16
+ [void](Test-ServiceFabricClusterConnection)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Test-ServiceFabricClusterConnection], NullReferenceException
+ FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.TestClusterConnection
Finished executing script 'Get-ServiceFabricApplicationStatus'.
Time elapsed: 00:02:04.7891918
The program '[27216] program.exe' has exited with code 0 (0x0).
Connect-ServiceFabricCluster : Could not ping any of the provided Service Fabric gateway endpoints.
At line:1 char:8
+ [void](Connect-ServiceFabricCluster); Import-Module 'C:\Program Files ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricTransientException
+ FullyQualifiedErrorId : TestClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
WARNING: Unable to Verify connection to Service Fabric cluster.
Test-ServiceFabricClusterConnection : Cluster connection instance is null
At C:\Program Files\Microsoft SDKs\Service
Fabric\Tools\PSModule\ServiceFabricSDK\Get-ServiceFabricApplicationStatus.ps1:27 char:16
+ [void](Test-ServiceFabricClusterConnection)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Test-ServiceFabricClusterConnection], NullReferenceException
+ FullyQualifiedErrorId : GetClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.TestClusterConnection
Finished executing script 'Get-ServiceFabricApplicationStatus'.
Time elapsed: 00:02:04.7166263
After maybe an hour or two of having service fabric open the cluster becomes unresponsive and I'm unable to deploy any application until I reset the cluster. The logs just constantly say:
Started executing script 'Get-ServiceFabricApplicationStatus'.
Finished executing script 'Get-ServiceFabricApplicationStatus'.
I am also unable to open the service fabric manager via the icon in the task bar but the url http://localhost:19080/Explorer still works.
Running: C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\CleanCluster.ps1 seems to reset it just fine and it works again for a couple of hours. Until (presumably) it gets to a point below where it runs out of connections and everything goes wrong.
The only logs I can seem to find on this are:
thousands of lines of this:
localhost:19000-127.0.0.1:59598: failed to locate connection 1eedf052ba0 to update instance
exceeded client connection limit: target=127.0.0.1:59598 max=1000
localhost:19000-127.0.0.1:59597: failed to locate connection 1eedf055db0 to update instance
Warning 2/26/2018 12:27:11 PM Microsoft-Service Fabric 57089 EntreeServiceProxy
Warning 2/26/2018 12:27:11 PM Microsoft-Service Fabric 4097 Transport
exceeded client connection limit: target=127.0.0.1:59596 max=1000
localhost:19000-127.0.0.1:59595: failed to locate connection 1eedf0536c0 to update instance
exceeded client connection limit: target=127.0.0.1:59595 max=1000
exceeded client connection limit: target=127.0.0.1:59595 max=1000
exceeded client connection limit: target=127.0.0.1:59594 max=1000
localhost:19000-127.0.0.1:59593: failed to locate connection 1eedf052ba0 to update instance
exceeded client connection limit: target=127.0.0.1:59593 max=1000
And my dns service seems to be in an unhealthy state:
Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus',
HealthState='Warning', ConsiderWarningAsError=false.
Replica had multiple failures during open on _Node_0. -2147467259
For more information see: http://aka.ms/sfhealth
Any advice on how to troubleshoot this service fabric issue?

unable to use SetPassword over domains through Powershell

I am trying to use the SetPassword method on a DirectoryEntry.
$Root = New-Object System.DirectoryServices.DirectoryEntry("LDAP://dc.ourdomain.com/OU=Users,DC=dc,DC=ourdomain,DC=com", $ldapusername, $ldappassword, "Secure")
$objUser = $Root.Create("user","CN=$DisplayName")
$objUser.Put("sAMAccountName", "$username")
$objUSer.Put("userPrincipalName","$userPrincipalName")
$objUser.Put("givenName", "$firstname")
$objUser.Put("sn", "$lastname")
$objUser.Put("description", "$description")
$objUser.Put("displayName", "$DisplayName")
$objUser.Put("mail", "$email")
$objUser.Put("company", "$Company")
$objUser.SetInfo()
$ObjUser.psbase.Invoke("SetPassword","qW12eR34")
$objUser.psbase.InvokeSet(“AccountDisabled”,$false)
$objUser.SetInfo()
Whenever I run this, I keep getting the following error:
Exception calling "Invoke" with "2" argument(s): "The RPC server is unavailable. (
Exception from HRESULT: 0x800706BA)"
At E:\Untitled1.ps1:27 char:23 + $ObjUser.psbase.Invoke <<<< ("SetPassword","qW12eR34")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodTargetInvocation
I am able to reset the password through Set-ADAccountPassword just fine, but I need to be able to do it through this way.. This function creates the user just fine, and it also sets the AccountDisable to false as it should do.
But it keeps failing on SetPassword..
I read around here that some people mentioned it could be due to blocked ports etc (Everything is open between the two servers) and some mentioned the AuthenticationType has to be set to Secure.. But I am setting it to Secure, and I am still having the same problem.
Thanks in advance..
Ok so i am pretty sure i found out why this is, i was trying to do something the same, and confirmed all ports (this works on port 135), are open, but port 135 never was able to recieve traffic from the world, called my ISP and yes, most ISP's these days, and with more to follow WILL block all traffic incoming on this port, so that's what your error is telling you.
It is trying to perform the actions but the requests are never reaching the server.
Call your provider and confirm, else check port 135 in your firewall rules on your incoming server (temporarily disabling firewall for testing will tell you)

TFS Build Agent stopped

I have a problem with a running build machine, where the agent suddenly does not want to start. It's been a part of a remote controller and for trouble shooting this issue, if started a local controller. The symptoms are, at the agent(s) initializes correct (says 'Ready'), but has the stopped icon and in the status area says 'BuildController has not been started in 1 minutes. The AD account running the build service works on another build machine (seperate controller + build agents). I've tried the following
Reinstall the build service
running with machine name, fully qualified domain name and IP address for endpoint address
un- and re-registered build service
rebooted
cleaned up build agent registrations with script
If I change the service account running the build service to my own AD account, it works. However, running under our dedicated build user failes on this particular machine, but not the other. Any suggestions what to do? Here's the error from the event log:
Service 'Default Agent - tfs2010build1' had an exception:
Exception Message: There was no endpoint listening at http://tfs2010build1:9191/Build/v3.0/Services/Controller/31 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. (type EndpointNotFoundException)
Exception Stack Trace:
Server stack trace:
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.TeamFoundation.Build.Machine.IBuildControllerService.TestConnectionFromController(String agentUri)
at Microsoft.TeamFoundation.Build.Machine.ServiceProxies.ServiceProxy`1.<>c__DisplayClass3.<Do>b__2(T channel)
at Microsoft.TeamFoundation.Build.Machine.ServiceProxies.ServiceProxy`1.Do[TResult](Func`2 action)
at Microsoft.TeamFoundation.Build.Machine.BuildAgentService.<>c__DisplayClass12.<TestConnection>b__11(Object )
Inner Exception Details:
Exception Message: Unable to connect to the remote server (type WebException)
Exception Stack Trace: at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
Inner Exception Details:
Exception Message: No connection could be made because the target machine actively refused it 127.0.0.1:38742 (type SocketException)
Exception Stack Trace: at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
Found the problem. Proxy server was enabled under IE options. Not sure why the build service worked under my AD user account and not the dedicated build user, but it solved the problem.
---->>>>>Update!
So we have 2 machines (B1 & B2), each with 2 agents. B1 had the initial problem and was solved by disabling the proxy settings under IE. Yesterday B2 suddenly started showing the same symptons and error messages on the 2 agents. Proxy setting is NOT enabled. While it did fix B1, it's not the universal solution for this particular problem.
It's hard work keeping these build agents running :( - Miss TeamCity...
---->>>>Update again!
So yesterday when I looked at the proxy configuration, it wasn't set. However this morning the checkbox was checked. Disabled the proxy and the agents went online. Very strange behavior! Wonder if Windows Update changes these settings...
I often get this same issue with the proxy when I am forced to manually stop a build. I have not been able to find any decent resolutions for this.

System.Runtime.InteropServices.COMException (0xC00E000B): The Message Queuing service is not available

When MSMQManagementClass.Init(Object& Machine, Object& PathName, Object& FormatName) method is called it works fine when the client and msmq service are both on the same box.
When the client and msmq service are in different domain i get the following error
System.Runtime.InteropServices.COMException (0xC00E000B): The Message
Queuing service is not available at
MSMQ.MSMQManagementClass.Init(Object& Machine, Object& PathName,
Object& FormatName)
on windows 2008 server
Below code gives the error
var msmq = new MSMQManagement();
var machineName = MachineName
var pathName = null
var formatName = DIRECT=TCP:ipaddress\private$\testq
msmq.Init(ref machineName, ref pathName, ref formatName);
but
this works fine
var queue = new MessageQueue(FormatName:DIRECT=TCP:ipaddress\private$\testq)
Do you mean cross-domain or cross-forest?
Cross-forest MSMQ? You need to be trusting
You are performing an RPC operation to a remote machine so the following should help:
Understanding how MSMQ security blocks RPC traffic
Cheers
John
To use MSMQ it requires that MSMQ is installed on both the sender and receiver.