cmdlet get-team runs in into throtteling - powershell

I try to get a list all Teams from a Tennant.
There are about 100 Teams.
The cmdlet Get-Team runs for ages and the Powershell-log says
2020-12-04T14:38:27.8608271Z Error Get-Team.GetTeam Microsoft.TeamsCmdlets.PowerShell.Custom.ErrorHandling.ApiException - Error occurred while executing
Code: TooManyRequests
Message: Too many requests from Identifier:XXXXXX under category:throttle.teams.ags.api_complex_level_10.app_normal.operation_read_sustained. Please try again later.
InnerError:
RequestId: XXX
DateTimeStamp: 2020-12-04T14:38:27
HttpStatusCode: TooManyRequests
. bei Microsoft.TeamsCmdlets.PowerShell.Custom.Utils.HttpUtilities.Get[T](HttpClient httpClient, Uri requestUri, Dictionary`2 headers)
bei Microsoft.TeamsCmdlets.PowerShell.Custom.TeamsCmdlet.GetTeam(String cmdletName, String uriSuffix, String groupId)
The API-Websites says, that the Get-Team call is limited to 60 requests/sec. I´m way below that value.
Even if I run it once, it takes several Minutes to complete. Is this a known bug? Does someone know a way around it?
*EDIT* I found a Solution: Install the latest prerelease (1.1.10) of the Teams-Module. With latest Stable (1.1.6) it didn´t work

what is the Version of module. if it is older version please update to latest.
Please check powershell version also.
if both are latest version. please run the get-team through Graph explorer share the outcome.

Related

Using Azure DevOps REST Api how can I get the build by its build number, except by listing all the builds?

So I see the Api to get the build by its build Id, but I cannot see one to get it by the build number. Is the only way to list all the builds?
You can use an optional parameter on the builds - List API
https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=4.0&buildNumber=0.0.1836.3
There is no API for getting a build according to the build number because theoretically, it could be few builds with the same build number, so if you want to retrieve the build according to the build number you need to get all the builds with this Rest API and then filter the results.
For example (with PowerShell):
# Get the results with Invoke-RestMethod
$builds = Invoke-RestMethod ...
$buildNumber = "10.7"
$myBuild = $builds.value.Where({ $_.buildNumber -eq $buildNumber})
this is the call you are looking for:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.0
edit: NVM, I misread the question. there is no way to get the build by its build number.

Get-AzureRMSubscription produces error after login with login-azurermaccount

I am trying to use get-azurermsubscription to get a list of available subscriptions in order to select one of five prior to running set-azurermcontext. I am getting the error:
Method not found: 'Microsoft.Azure.Subscriptions.Models.SubscriptionListResult'
get-azurermcontext displays a valid tenatant id and valid subscription id, but of course does not display all of the subscriptions.
I downloaded the March 2015 Powershell installer to make sure everything was up to date, but have the same issues.
Just upgraded to VisualStudio 2015 update 2 and powershell v5. Have another machine with a similar configuration that works fine.
What should I do to fix this issue?
I can't add a comment so doing it this way instead. On July 12 2016 AzureRM module received and update to version 1.6.0. I confirmed the cmd Get-AzureRMSubsctiption works from a Windows 10 machine.

How to get Resharpers InspectCode to recognize Plugins?

I am trying to run ReSharpers command line tool InspectCode.exe. It's running fine doing it's job with the expected output.
However after my earlier attempt to get plugins to work, this time with the new version it is supposed to be supported. There is a switch in the command line interface that allows to specify the extension you want to use.
/extensions (/x) – allows using ReSharper extensions that affect code analysis. To use an extension, specify its ID, which you can find by opening the extension package page in the ReSharper Gallery, and then the Package Statistics page. Multiple values are separated with the semicolon.
But I cannot get it to work properly. I cannot even provoke any reaction to the /x switch at all. No matter how or what I pass, I get no feedback from the executable and the output is identical. I don't even get an error message when passing obvious garbage.
I tried the following commandlines for the exact same result:
inspectcode.exe /o="rcli.xml" /swea /x="ReSharper.StyleCop" "my.sln"
inspectcode.exe /o="rcli.xml" /swea /x=ReSharper.StyleCop "my.sln"
inspectcode.exe /o="rcli.xml" /swea "my.sln"
inspectcode.exe /o="rcli.xml" /swea /x=ABCDEFG "my.sln"
Result
JetBrains Inspect Code 9.1.1
Running in 64-bit mode, .NET runtime 4.0.30319.18444 under Microsoft Windows NT
6.1.7601 Service Pack 1
Enabled solution-wide analysis according to Inspect Code command line Setting.
Analyzing files
[files]
Inspection report was written to rcli.xml
What am I doing wrong? How to get extensions to work?
I already tried the R# forums, but it took them more then 24h to approve my post and so far I'm not sure someone else even read it.
Unfortunately, the support for extensions was dropped in 9.0 due to the refactorings in the "ReSharper platform". I hope that JetBrains will bring it back soon.
See RSRP-436208.
This is a late answer that might help future readers (like myself). Currently inspectcode.exe will automatically look for and use any NuGet packages that are in the same folder as the executable (source).
Example for CleanCode extension:
if you have a R# instance on some machine and install the extension, it will be placed in C:\Users\{user}\AppData\Local\JetBrains\plugins\MO.CleanCode.5.6.15
copy MO.CleanCode.5.6.15.nupkg and paste it next to inspectcode.exe
when running inspectcode with verbosity = VERBOSE, the extension should appear in the Zones list:
$cmd = "..\JetBrains.ReSharper.CommandLineTools.2019.3.4\inspectcode.exe"
$outputFile = "..\Output\$($outputName).xml"
& $cmd -o="$outputFile" $sln --verbosity=VERBOSE
Zones: (52pcs)[CodeInspectionPageImplZone, DaemonEngineZone,
DaemonZone, IAmd64CpuArchitectureHostZone, IAspMvcZone,
IBatchToolEnvironmentZone, IClrImplementationHost Zone,
IClrPsiLanguageZone, ICodeEditingOptionsPageImplZone,
IConsoleEnvironmentZone, ICppProductZone, ICpuArchitectureHostZone,
IDocumentModelZone, IEnvironmentZone, IHostSolutionZone,
IInspectCodeConsoleEnvironmentZone, IInspectCodeEnvironmentZone,
IInspectCodeZone, ILanguageAspZone, ILanguageBuildScriptsZone,
ILanguageCppZone, I LanguageCSharpZone, ILanguageCssZone,
ILanguageHtmlZone, ILanguageIlZone, ILanguageJavaScriptZone,
ILanguageMsBuildZone, ILanguageNAntZone, ILanguageProtobufZone, ILa
nguageRazorZone, ILanguageRegExpZone, ILanguageResxZone,
ILanguageVBZone, ILanguageXamlZone, INetFrameworkHostZone, INuGetZone,
IOperatingSystemHostZone, IProjectMode lZone,
IPsiAssemblyFileLoaderImplZone, IPsiLanguageZone,
IPublicVisibilityZone, IRdFrameworkZone, IRiderModelZone,
ISinceClr2HostZone, ISinceClr4HostZone, ITextContro lsZone,
IToolsOptionsPageImplZone, IWebPsiLanguageZone, IWindowsNtHostZone,
PsiFeaturesImplZone, ReplaceableByIntelliJPlatformZone, SweaZone]
Packages: (23pcs)[JetBrains.ExternalAnnotations,
JetBrains.Platform.Core.Ide, JetBrains.Platform.Core.IisExpress,
JetBrains.Platform.Core.MsBuild, JetBrains.Platform. Core.Shell,
JetBrains.Platform.Core.Text, JetBrains.Platform.Interop.CommandLine,
JetBrains.Platform.Interop.dotMemoryUnit.Framework,
JetBrains.Platform.Interop.dotMe moryUnit.Interop.Console,
JetBrains.Platform.Interop.dotMemoryUnit.Interop.Ide,
JetBrains.Platform.RdProtocol, JetBrains.Psi.Features.Core,
JetBrains.Psi.Features.Cpp .Src.Core, JetBrains.Psi.Features.src,
JetBrains.Psi.Features.Tasks, JetBrains.Psi.Features.UnitTesting,
JetBrains.Psi.Features.Web.Core, JetBrains.ReSharperAutomatio
nTools.src.CleanupCode,
JetBrains.ReSharperAutomationTools.src.CommandLineCore,
JetBrains.ReSharperAutomationTools.src.CommandLineProducts,
JetBrains.ReSharperAutomat ionTools.src.DuplicatesFinder,
JetBrains.ReSharperAutomationTools.src.InspectCode, MO.CleanCode]

Create DataSource for DB2 Provider using wsadmin (Websphere Application Server 8.5)

I have a script which create a Data Source using a DB2 JDBC Provider in Websphere Application Server 8.5. So I am fighting with an error while running the script and I need some help pls.
My script:
def createDB2(list):
print 'Creating DB2 Data Source...'
for dataSource in list:
datasourceName=dataSource[0]
dsJNDIName=dataSource[1]
compAuthAlias=dataSource[2]
providerName=dataSource[3]
dataStoreHelperClassName=dataSource[4]
description=dataSource[5]
serverName=dataSource[6]
databaseMaxConnections=dataSource[7]
databaseMinConnections=dataSource[8]
databaseconnTimeout=dataSource[9]
databasereapTime=dataSource[10]
databaseunusedTimeout=dataSource[11]
databaseagedTimeout=dataSource[12]
#Creare sursa de date
dataSourceId = AdminJDBC.createDataSourceAtScope( scope, providerName, datasourceName, dsJNDIName, dataStoreHelperClassName, serverName, [['componentManagedAuthenticationAlias',compAuthAlias],['containerManagedPersistence','true'],['description',description]] )
connectionPoolList = AdminConfig.list('ConnectionPool', dataSourceId)
connectionPoolList = AdminUtilities.convertToList(connectionPoolList)
connectionPoolId = connectionPoolList[0]
AdminConfig.modify(connectionPoolId, [["maxConnections", databaseMaxConnections], ["minConnections", databaseMinConnections], ["connectionTimeout", databaseconnTimeout], ["reapTime", databasereapTime], ["unusedTimeout", databaseunusedTimeout], ["agedTimeout", databaseagedTimeout]])
print 'Saving configuration...'
AdminConfig.save()
print "Configuration saved."
My input list:
[datasourceName, JNDIName, AuthAlias, providerName, dataStoreHelperClassName, description, srvName, maxConnections, minConnections, connTimeout, reapTime, unusedTimeout, agedTimeout]
I am using the same script to create an Oracle Data Source with no errors. The difference that I know between theese process is the serverName. For DB2 is a ServerName and for Oracle is an URL. Is there another difference that I don't know? Does anyone see an error or a mistake in my code?
My error:
Exception: com.ibm.ws.scripting.ScriptingException com.ibm.ws.scripting.ScriptingException: com.ibm.ws.scripting.ScriptingException: WASX8018E: Cannot find a match for option value [databaseName, java.lang.String, TestSRV] for step configureResourceProperties
WASX7017E: Exception received while running file "createDataSource.py"; exception information: com.ibm.ws.scripting.ScriptingException: WASX8018E: Cannot find a match for option value [databaseName, java.lang.String, TestSRV] for step configureResourceProperties
If you need more information leave a comment pls. Thanks in advance!
EDIT 03.03.2015
I found some examples in a RedBook from IBM.
Examples scripts for the DB2 database type:
The following example script includes optional attributes in a string format:
AdminJDBC.createDataSourceAtScope("Cell=IBM-F4A849C57A0Cell01,Node=IBM-F4A849C57A0Node01,Server=server1", "MyTestJDBCProviderName", "newds2", "newds2/jndi", "com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper", "db1", " category=myCategory, componentManagedAuthenticationAlias=CellManager01/AuthDataAliase, containerManagedPersistence=true, description=’My description’, xaRecoveryAuthAlias=CellManager01/xaAliase", "serverName=localhost, driverType=4,portNumber=50000")
The following example script includes optional attributes in a list format:
AdminJDBC.createDataSourceAtScope("Cell=IBM-F4A849C57A0Cell01,Node=IBM-F4A849C57A0Node01,Server=server1", "MyTestJDBCProviderName", "newds2", "newds2/jndi", "com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper", "db1", [[’category’, ’myCategory’], [’componentManagedAuthenticationAlias’, ’CellManager01/AuthDataAliase’], [’containerManagedPersistence’, ’true’], [’description’, ’My description’], [’xaRecoveryAuthAlias’, ’CellManager01/xaAliase’]] , [[’serverName’, ’localhost’], [’driverType’, 4], [’portNumber’, 50000]])
EDIT 16.04.2015
I am using the built in function createDataSourceAtScope and I have another example:
def createDataSourceAtScope( scope, JDBCName, datasourceName, jndiName, dataStoreHelperClassName, dbName, otherAttrsList=[], resourceAttrsList=[], failonerror=AdminUtilities._BLANK_ ):
I have to call the function like above. Did anyone see the problem? :)
The built-in scripts are in:dmgrProfile/scriptLibraries/resources/JDBC/V70
I still don't know how to fix my problem. If anyone has an ideea please leave a comment or an answer. Thank you very much!
I know it's too late, but I struggled with the same problem for Websphere on Docker. Then, I would like to share my solution.
Command to debug the scripts on ibmcom/websphere-traditional:8.5.5.18
/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -conntype None -f exportConfig.py
Jython script
import os
import sys
newjdbc = AdminConfig.getid('/JDBCProvider:"DB2 Universal JDBC Driver Provider"/')
ds = AdminTask.createDatasource(newjdbc, '[-name NameDataSource -jndiName jdbc/NameDataSource -description "DB2 Universal Driver Datasource" -dataStoreHelperClassName com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper -containerManagedPersistence true -componentManagedAuthenticationAlias db2inst1 -configureResourceProperties [[databaseName java.lang.String SAMPLE][portNumber java.lang.Integer 50000][serverName java.lang.String 172.17.0.3]]]')
AdminConfig.create('MappingModule', ds, '[[authDataAlias db2inst1] [mappingConfigAlias "DefaultPrincipalMapping"]]')
AdminConfig.save()

Set-SPDebug -trace 1 not working in PowerShell host

I have a few PowerShell hosts, and in these hosts Set-SPDebug -trace 1 does not work.
I tested PoshConsole, here it works, but for example the Host6 in the PowerShell SDK does not work.
Any idea what is required in a host to get this working?
My smart collegue Jan Pieter Guelen found the answer after going through the PowerShell automation api using Reflector. You have to enable history in CreatePipeline with the following code:
pipeline = runspace.CreatePipeline("", true);
Now the tracing works!Even the Wrox book "Windows PowerShell Programming" does not mention this:-( The PowerShell SDK sample (Host6) should include this as well... PoshConsole does this as well, but I never thought that this would be the problem.
In what way isn't it working? If you aren't seeing any output, did you override the WriteDebugLine() method of the PSHostUserInterface base class e.g.:
public override void WriteDebugLine(string message)
{
this.WriteLine(ConsoleColor.DarkYellow, ConsoleColor.Black,
String.Format(CultureInfo.CurrentCulture, "DEBUG: {0}", message));
}