Is it possible to create an Agent Pool in TFS 2018 programatically, preferably via PowerShell? I cannot find anything like that in REST API.
I don't know why it's not well-documented, but this just worked for me against VSTS:
$token = 'myPAT'
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes((":{0}" -f $token)))
$uri = 'https://<url>/_apis/distributedtask/pools?api-version=4.1-preview.1'
$result = Invoke-RestMethod -Uri $uri -Method Post -ContentType "application/json" -Headers #{Authorization=("Basic {0}" -f $base64AuthInfo)} `
-Body (ConvertTo-Json #{name = 'foo'; autoProvision = $true})
I just looked at the REST API used in the web portal to create an agent pool and copied it; if the API version isn't the same in TFS 2018 as it is in VSTS, you can do the same thing to find the correct version to use.
The REST API of TFS has an undocumented portion that deals with app pools: _apis/distributedtask/pools. For example:
Get agent pools (Request method: Get):
http://[TFS URL]/_apis/distributedtask/pools?api-version=x.x-preview.1`
api-version should match your TFS version
You could open up Chrome/IE Network inspector and found that the API calls for create agent pool action. How to do this please refer:
Analyzing your webpage's network traffic
Using Windows Internet Explorer Developer Tools Network Capture
Finally, you just need to call REST API through PowerShell, take a look at this answer.
Related
I am integrating Jenkins in Slack to facilitate build from Slack.
I configured the Build Trigger section of my job
Then I added Slash Commands to slack and configured it as below.
Now, I went to slack and typed /dev-backend, and it is throwing the error,
/dev-backend failed with the error "invalid_url"
I tried hitting the URL directly from postman which is giving the Authentication required response.
How can I add the authentication so that I can trigger build from slack? I thought the token provided in the build triggers section of Jenkins was enough.
I know it's kind of outdated question but I was also struggling with this error, so maybe it will help someone in the future. If you are getting /command failed with the error "invalid_url" and you are able to hit your application endpoint via eg. Bash shell:
curl -X POST -H 'Authorization: Bearer your-bearer-token' -H 'Content-type: application/json;charset=utf-8' --data '{"channel":"#test","text":"Hello, Slack!"}' http://127.0.0.1:8000/your/application/endpoint
it means that Slack can't access/see the URL that you passed in Slack API Applications Settings.
In my case the problem was that I was passing http://127.0.0.1:8000/some/endpoint in Slash Commands configuration which was visible only by my computer. The easiest way to make it visible for Slack is to use ngrok.
So if you are getting this error the steps are as follows:
Install ngrok
Run your app on localhost, eg. http://127.0.0.1:8000
In Bash shell type ngrok http 8000
Copy url returned by ngrok, in my case http://c609-91-234-49-229.ngrok.io
Paste copied URL to Slack Slash Commands configuration instead of localhost.
I'm creating an Azure AppService based on a Docker image. The image is in Docker public registry, so I want the service to 'know' when there's a new version of the image (same tag).
I thought the WebHook under Continuous Deployment was to achieve that, but when I call it with curl I get the message from the subject.
I couldn't find the right doc... is that WebHook URL for what I think (hope) it is? is there a specific HTTP verb to use?
EDIT: I mean the WebHook URL found under Continuous Deployment in my Container Settings in Azure
I was stuck on this one for some time as well, until I realized that it requires POST HTTP request on that URL.
Here is an example of the CURL request that I have in my gitlab CI script
curl -X POST "https://\$$AZURE_DEPLOY_USER:$AZURE_DEPLOY_PASSWORD#$AZURE_KUDU_URL/docker/hook" -d -H
It does require to have set the following variables in the environment or you can replace it directly with your URL
$AZURE_DEPLOY_USER
$AZURE_DEPLOY_PASSWORD
$AZURE_KUDU_URL
I want to administrate the company computers with Powershell from my laptop.
So I assume my laptop is the Server and the rest are Clients.
So I make my computer a server (the computer that I initiate all the remote connections)
Enable-WSManCredSSP -Role Server
+ I enter wsman/* in the GPO (which is needed on the machine that initiate the remote)
And then I make the rest of the computers clients as fallows:
Enable-WSManCredSSP -Role Client -DelegateComputer *
If everything goes as I suppouse I shold be able to connect from the Server to the Client , but I get an error.
But if I try the opposite, from the client to the server it works perfectly (after I set the wsman/* in the GPO of course ).
Can someone explain how Server/Client role are suppose to work ?.
P.S.
The error I get when trying to connect from Server > Client is the fallowing:
Enter-PSSession : Connecting to remote server failed with the following error message : The WinRM client cannot process
the request. CredSSP authentication is currently disabled in the client configuration. Change the client configuration
and try the request again. CredSSP authentication must also be enabled in the server configuration. Also, Group Policy
must be edited to allow credential delegation to the target computer. Use gpedit.msc and look at the following policy:
Computer Configuration -> Administrative Templates -> System -> Credentials Delegation -> Allow Delegating Fresh Crede
ntials. Verify that it is enabled and configured with an SPN appropriate for the target computer. For example, for a t
arget computer name "myserver.domain.com", the SPN can be one of the following: WSMAN/myserver.domain.com or WSMAN/*.do
main.com For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:16
+ Enter-PSSession <<<< -ComputerName 192.168.30.122 -Credential IT -Authentication CredSSP
+ CategoryInfo : InvalidArgument: (192.168.30.122:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
Did you set your policy to allow delegation of Fresh Credentials?
Computer Configuration -> Administrative Templates -> System ->
Credentials Delegation -> Allow Delegating Fresh Credentials.
What is your Enter-PSSession invocation?
PS> $cred = Get-Credential
PS> Enter-PSSession 192.168.30.122 -Authentication CredSSP -Credential $cred
[xxxx.yyyy.local]: PS C:\Users\zzzz\Documents>
When i tried to connect to Exchange online by using powershell the following error arises for me.
$LiveCred = Get-Credential
Username
password
$Session = New-PSSession -ConfigurationName Microsoft.Exchange
-ConnectionUri https://ps.outlook.com/powershell/ -Credential
$LiveCred -Authentication Basic -AllowRedirection //While creating session the error
occurs."[ps.outlook.com] The WinRM client cannot process the request because the server name
cannot be resolved"..
i have configured the winrm correctly..
C:\Windows\system32>winrm quickconfig
WinRM is already set up to receive requests on this machine.
WinRM is already set up for remote management on this machine.
But still the error exists for me.
I came here with the same issue, however, I do notice the Uri value you are trying to use appears to have been updated to https://outlook.office365.com/powershell-liveid/.
The method given http://technet.microsoft.com/en-GB/library/jj984289%28v=exchg.150%29.aspx did work for me, but at the moment it's not. Surely MS aren't down!!!
i need a complete procedure on how to setup Oauth 2.0 authentification between my own IBM/Notes/Domino/XPages apps and my own Connections 4.5 server (no greenhouse or quick start connections over the web)
Have installed both are on the same machine same host name with different ports :
Connections 4.5 (HTTP 80/HTTPS 443)
Running secure mode ok
Domino 9 (HTTP 8088/ HTTPS 44388)
Accessing Connections in SSL works fine.
Runnig XPages SSL/Domino with specific ports too.
Follow the IBM SBT docs :
http://www-10.lotus.com/ldd/lcwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+Documentation#action=openDocument&res_title=Registering_an_OAuth_client_with_a_provider_ic45&content=pdcontent
Create a credential on the WAS 8.0.0.6 :
http://www-10.lotus.com/ldd/lcwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+Documentation#action=openDocument&res_title=Managing_the_client_application_list_ic45&content=pdcontent
but have question about the redirecturi to specify when creating credentials ? {opensocialSvcUrl}/gadgets/oauth2callback" stated is for gadget only no ?
Question is how to create correct credential in websphere and how to configure it in the SBTPayground.nsf Lotus application (Open NTF) to succesfully log in via OAuth2.0 (only basic authentication works...)
Thanks for any help.
Here is the documentation to register an application with the Connections OAuth 2 provider. For step c the parameters are pretty self explanatory but you need to know the callback URL. The callback URL for the playground is /SBTPlayground.nsf/xsp/.sbtservice/oauth20_cb
create a file such as /local/qsi/bin/conx/oauthQSI.py
input these lines
import sys
execfile('oauthAdmin.py')
OAuthApplicationRegistrationService.addApplication(sys.argv[0],sys.argv[1],sys.argv[2])
clientSecret = OAuthApplicationRegistrationService.getApplicationById(sys.argv[0]).get('client_secret')
print clientSecret
Then change directory to you connection deployment manager profile
cd ${CON_PROFILE_DM}/bin/
Run this command
${CON_PROFILE_DM}/bin/wsadmin.sh -user $USER -password $PASSWORD -lang jython -port 8879 -conntype SOAP -f /local/qsi/bin/conx/oauthQSI.py $CLIENTID $APPID $URL
$CLIENTID = playground
$APPID = playground
$URL = https://XYZ.com/sbtplayground.nsf/xsp/.sbtservice/oauth20_cb
You can then edit the evironment properties to point to the echod clientsecret and the connections server at
https://abc.com:444/oauth2/endpoint/connectionsProvider/authorize
https://abc.com:444/oauth2/endpoint/connectionsProvider/token
if it fails saying filter invalid, make sure (if the cert is self signed) that you import it into the trust store for the cell you have on WebSphere