powershell-core

Connect-AzAccount - how to avoid azure device authentication?

别说谁变了你拦得住时间么 提交于 2020-05-08 09:26:00
问题 I have installed the PowerShell 6.1.3 version and I want to get a connection to the Azure account using the following Azure PowerShell command: Connect-AzAccount -Tenant <tenantId> -Subscription <subId> After entering this command I get the warning with the url and some code. Then I have to go to the URL and enter the code there. After that, I get a connection to the Azure account. Are there any ways to avoid this confirmation? I've also tried to do it using the following command: az login -u

Connect-AzAccount - how to avoid azure device authentication?

馋奶兔 提交于 2020-05-08 09:25:12
问题 I have installed the PowerShell 6.1.3 version and I want to get a connection to the Azure account using the following Azure PowerShell command: Connect-AzAccount -Tenant <tenantId> -Subscription <subId> After entering this command I get the warning with the url and some code. Then I have to go to the URL and enter the code there. After that, I get a connection to the Azure account. Are there any ways to avoid this confirmation? I've also tried to do it using the following command: az login -u

AWS Lambda Powershell to create mailbox in Hybrid(run powershell commands in both Office 365 and On-Prem)

我的未来我决定 提交于 2020-04-30 10:09:36
问题 Now that AWS Lambda supports PowerShell core according to this blog, has anybody tried running PowerShell commands to create Mailbox in Hybrid env(run PS cmdlets in both On-prem and office 365 env) using lambda? I couldn't find anything online which does that. Most of the Lambda Powershell usecases seems to be related to using PowerShell scripts to automate and manage AWS resources. I'm working on a POC for a REST service which does all of the mailbox creation operations and was planning to

Are there any implicit assumptions in Import-Clixml when importing credentials?

…衆ロ難τιáo~ 提交于 2020-02-22 08:01:47
问题 I wonder if there are any implicit assumptions that I've taken that may make the code malfunction? There is a reason I want to avoid using Import-Clixml cmdlet? Hence, I've developed an alternative, i.e. a sequence of command that is aimed to extract username and password from CliXml file created with Export-Clixml. It works by now but I'm not sure if for instance the splitting solution is reliable. $credFileUriBld = [UriBuilder]::New('file','localhost',-1,"MyCredentials.xml")) $credFile =

Are there any implicit assumptions in Import-Clixml when importing credentials?

自作多情 提交于 2020-02-22 08:01:28
问题 I wonder if there are any implicit assumptions that I've taken that may make the code malfunction? There is a reason I want to avoid using Import-Clixml cmdlet? Hence, I've developed an alternative, i.e. a sequence of command that is aimed to extract username and password from CliXml file created with Export-Clixml. It works by now but I'm not sure if for instance the splitting solution is reliable. $credFileUriBld = [UriBuilder]::New('file','localhost',-1,"MyCredentials.xml")) $credFile =

How to authenticate to an Azure Function using function auth or Azure AD service principal

喜你入骨 提交于 2020-02-07 05:41:51
问题 I have an Azure function which I'm using to fetch data from Azure AD, but I want to limit who can use the Function as it will be using a HTTP trigger so that I will be able to call the function from a Logic App later down the road. So as HTTP triggered Azure Functions have a public endpoint, I want to improve security by setting the authorization level to Function, or even more preferable to use an Azure AD service principal (pre-created). Upon making this change though I can make the call by

Whats the replacement for WebResponse.AllElements in PowerShell Core 6?

巧了我就是萌 提交于 2020-01-25 05:22:24
问题 I have to parse a html file (find div with class xyz and use the inner text). That would be quit simple by using and filtering the WebResponse.AllElements collection. This member seems to be not available in PowerShell Core 6 (on a Mac). On this platform, I get an BasicHtmlWebResponseObject as the return value of the Invoke-WebRequest $Url call which lags tis property. I don't want to use any C# code or external libraries. What would be an maintainable way to get the same functionality as on

How to unit test a PowerShell Core binary cmdlet in C#

我的未来我决定 提交于 2020-01-14 03:17:08
问题 I've written a simple PowerShell cmdlet in C# to show off the problem I'm encountering. Feel free to clone the repo, or fork it and get it working and submit a PR, or just look at the source code to see exactly what I am doing. I've created a simple PowerShell Core cmdlet using the PowerShellStandard.Library NuGet package. I'm using xUnit and am trying to run a unit test against the PowerShell cmdlet that I've created. The problem is that when I call the .Invoke() method of the cmdlet

Updating help on PowerShell on Mac

浪尽此生 提交于 2020-01-03 14:19:35
问题 I'm new to PowerShell and I know on PowerShell on windows you need to run as administrator to update the help files, but how do you update help files on PowerShell on Mac? 回答1: At this time, it does not look like the Update-Help Cmdlet is supported for Mac or Linux. For the time being I would suggest going to the technet website for each help file. You can get there from the Command Line with the -Online parameter: Get-Help Write-Output -Online or Get-Help about_Functions -Online These

Unable to Import-module DnsClient module in PowerShell core(PS6.2)

♀尐吖头ヾ 提交于 2019-12-25 01:48:57
问题 Unable to Import-module DnsClient module in PowerShell core(PS6.2), I recently installed PowerShell 6.2 and trying to run Get-DnsClientServerAddress . Getting Error: The term 'Get-DnsClientServerAddress' is not recognized as the name of cmdlet,function, script file. I tried to resolve this by running the below command. import-module DnsClient -SkipEditionCheck But again getting the error: Could not load type 'System.Management.Automation.PSSnapIn' from assembly 'System.Management.Automation,