mirror of
https://github.com/azure/login.git
synced 2026-03-15 09:20:56 -04:00
Compare commits
2 Commits
releases/v
...
sy/ncc-tes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e71c9e98f6 | ||
|
|
67253182eb |
46
.github/workflows/azure-login-pr-check.yml
vendored
46
.github/workflows/azure-login-pr-check.yml
vendored
@@ -1,12 +1,13 @@
|
|||||||
name: pr-check
|
name: pr-check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request_target:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- 'releases/*'
|
- 'releases/*'
|
||||||
jobs:
|
jobs:
|
||||||
az-login-test:
|
az-login-test:
|
||||||
|
environment: Automation test
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout from PR branch
|
- name: Checkout from PR branch
|
||||||
@@ -27,5 +28,44 @@ jobs:
|
|||||||
- name: Build GitHub Action
|
- name: Build GitHub Action
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Run mock test
|
- name: 'Az CLI login with subscription'
|
||||||
run: npm run test
|
uses: ./
|
||||||
|
with:
|
||||||
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
az account show --output none
|
||||||
|
az vm list --output none
|
||||||
|
|
||||||
|
- name: 'Az CLI login without subscription'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
creds: ${{ secrets.AZURE_CREDENTIALS_NO_SUB }}
|
||||||
|
allow-no-subscriptions: true
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
az account show --output none
|
||||||
|
# az vm list --output none
|
||||||
|
|
||||||
|
- name: 'Azure PowerShell login with subscription'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
enable-AzPSSession: true
|
||||||
|
|
||||||
|
- uses: azure/powershell@v1
|
||||||
|
with:
|
||||||
|
inlineScript: "(Get-AzContext).Environment.Name"
|
||||||
|
azPSVersion: "latest"
|
||||||
|
|
||||||
|
# - name: 'Azure PowerShell login without subscription'
|
||||||
|
# uses: ./
|
||||||
|
# with:
|
||||||
|
# creds: ${{secrets.AZURE_CREDENTIALS_NO_SUB}}
|
||||||
|
# enable-AzPSSession: true
|
||||||
|
# allow-no-subscriptions: true
|
||||||
|
|
||||||
|
# - uses: azure/powershell@v1
|
||||||
|
# with:
|
||||||
|
# inlineScript: "Get-AzContext"
|
||||||
|
# azPSVersion: "latest"
|
||||||
|
|||||||
@@ -7,4 +7,3 @@ Resources:
|
|||||||
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
|
||||||
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
|
||||||
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
|
||||||
- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support)
|
|
||||||
|
|||||||
71
README.md
71
README.md
@@ -183,9 +183,9 @@ name: Run Azure Login with OIDC
|
|||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: read
|
contents: read
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -195,9 +195,9 @@ jobs:
|
|||||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/CLI@v1
|
||||||
with:
|
with:
|
||||||
azcliversion: latest
|
azcliversion: latest
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
@@ -213,9 +213,9 @@ name: Run Azure Login with OIDC
|
|||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: read
|
contents: read
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -226,16 +226,16 @@ jobs:
|
|||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/CLI@v1
|
||||||
with:
|
with:
|
||||||
azcliversion: latest
|
azcliversion: latest
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
az account show
|
az account show
|
||||||
|
|
||||||
- name: Azure PowerShell script
|
- name: Azure PowerShell script
|
||||||
uses: azure/powershell@v2
|
uses: azure/powershell@v1
|
||||||
with:
|
with:
|
||||||
azPSVersion: "latest"
|
azPSVersion: "latest"
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
@@ -281,17 +281,18 @@ jobs:
|
|||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: azure/login@v2
|
- uses: azure/login@v2
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/CLI@v1
|
||||||
with:
|
with:
|
||||||
azcliversion: latest
|
azcliversion: latest
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
az account show
|
az account show
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- **The workflow sample to run both Azure CLI and Azure PowerShell**
|
- **The workflow sample to run both Azure CLI and Azure PowerShell**
|
||||||
@@ -308,21 +309,21 @@ jobs:
|
|||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: azure/login@v2
|
- uses: azure/login@v2
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/CLI@v1
|
||||||
with:
|
with:
|
||||||
azcliversion: latest
|
azcliversion: latest
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
az account show
|
az account show
|
||||||
|
|
||||||
- name: Azure PowerShell script
|
- name: Azure PowerShell script
|
||||||
uses: azure/powershell@v2
|
uses: azure/powershell@v1
|
||||||
with:
|
with:
|
||||||
azPSVersion: "latest"
|
azPSVersion: "latest"
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
@@ -371,29 +372,29 @@ Now you can try the workflow to login with system-assigned managed identity.
|
|||||||
name: Run Azure Login with System-assigned Managed Identity
|
name: Run Azure Login with System-assigned Managed Identity
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Azure login
|
- name: Azure login
|
||||||
uses: azure/login@v2
|
uses: azure/login@v2
|
||||||
with:
|
with:
|
||||||
auth-type: IDENTITY
|
auth-type: IDENTITY
|
||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|
||||||
# Azure CLI Action only supports linux self-hosted runners for now.
|
# Azure CLI Action only supports linux self-hosted runners for now.
|
||||||
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
|
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/CLI@v1
|
||||||
with:
|
with:
|
||||||
azcliversion: latest
|
azcliversion: latest
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
az account show
|
az account show
|
||||||
|
|
||||||
- name: Azure PowerShell script
|
- name: Azure PowerShell script
|
||||||
uses: azure/powershell@v2
|
uses: azure/powershell@v1
|
||||||
with:
|
with:
|
||||||
azPSVersion: "latest"
|
azPSVersion: "latest"
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
@@ -437,7 +438,7 @@ Now you can try the workflow to login with user-assigned managed identity.
|
|||||||
name: Run Azure Login with User-assigned Managed Identity
|
name: Run Azure Login with User-assigned Managed Identity
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
@@ -445,22 +446,22 @@ jobs:
|
|||||||
uses: azure/login@v2
|
uses: azure/login@v2
|
||||||
with:
|
with:
|
||||||
auth-type: IDENTITY
|
auth-type: IDENTITY
|
||||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|
||||||
# Azure CLI Action only supports linux self-hosted runners for now.
|
# Azure CLI Action only supports linux self-hosted runners for now.
|
||||||
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
|
# If you want to execute the Azure CLI script on a windows self-hosted runner, you can execute it directly in `run`.
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/CLI@v1
|
||||||
with:
|
with:
|
||||||
azcliversion: latest
|
azcliversion: latest
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
az account show
|
az account show
|
||||||
|
|
||||||
- name: Azure PowerShell script
|
- name: Azure PowerShell script
|
||||||
uses: azure/powershell@v2
|
uses: azure/powershell@v1
|
||||||
with:
|
with:
|
||||||
azPSVersion: "latest"
|
azPSVersion: "latest"
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
@@ -481,12 +482,13 @@ jobs:
|
|||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: azure/login@v2
|
- uses: azure/login@v2
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
environment: 'AzureUSGovernment'
|
environment: 'AzureUSGovernment'
|
||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Login to Azure Stack Hub
|
### Login to Azure Stack Hub
|
||||||
@@ -503,12 +505,13 @@ jobs:
|
|||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: azure/login@v2
|
- uses: azure/login@v2
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
environment: 'AzureStack'
|
environment: 'AzureStack'
|
||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Refer to the [Azure Stack Hub Login Action Tutorial](https://learn.microsoft.com/azure-stack/user/ci-cd-github-action-login-cli) for more detailed instructions.
|
Refer to the [Azure Stack Hub Login Action Tutorial](https://learn.microsoft.com/azure-stack/user/ci-cd-github-action-login-cli) for more detailed instructions.
|
||||||
@@ -539,14 +542,14 @@ jobs:
|
|||||||
enable-AzPSSession: true
|
enable-AzPSSession: true
|
||||||
|
|
||||||
- name: Azure CLI script
|
- name: Azure CLI script
|
||||||
uses: azure/cli@v2
|
uses: azure/CLI@v1
|
||||||
with:
|
with:
|
||||||
azcliversion: latest
|
azcliversion: latest
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
az account show
|
az account show
|
||||||
|
|
||||||
- name: Run Azure PowerShell
|
- name: Run Azure PowerShell
|
||||||
uses: azure/powershell@v2
|
uses: azure/powershell@v1
|
||||||
with:
|
with:
|
||||||
azPSVersion: "latest"
|
azPSVersion: "latest"
|
||||||
inlineScript: |
|
inlineScript: |
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ describe("Getting AzLogin PS script", () => {
|
|||||||
let loginConfig = new LoginConfig();
|
let loginConfig = new LoginConfig();
|
||||||
loginConfig.initialize();
|
loginConfig.initialize();
|
||||||
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
||||||
expect(loginScript.includes("$psLoginSecrets = ConvertTo-SecureString 'client-secret' -AsPlainText -Force; $psLoginCredential = New-Object System.Management.Automation.PSCredential('client-id', $psLoginSecrets); Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -Credential $psLoginCredential -InformationAction Ignore | out-null;")).toBeTruthy();
|
expect(loginScript.includes("$psLoginSecrets = ConvertTo-SecureString 'client-secret' -AsPlainText -Force; $psLoginCredential = New-Object System.Management.Automation.PSCredential('client-id', $psLoginSecrets); Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -Credential $psLoginCredential | out-null;")).toBeTruthy();
|
||||||
expect(loginMethod).toBe('service principal with secret');
|
expect(loginMethod).toBe('service principal with secret');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -61,7 +61,7 @@ describe("Getting AzLogin PS script", () => {
|
|||||||
let loginConfig = new LoginConfig();
|
let loginConfig = new LoginConfig();
|
||||||
loginConfig.initialize();
|
loginConfig.initialize();
|
||||||
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
||||||
expect(loginScript.includes("$psLoginSecrets = ConvertTo-SecureString 'client-se''cret' -AsPlainText -Force; $psLoginCredential = New-Object System.Management.Automation.PSCredential('client-id', $psLoginSecrets); Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -Credential $psLoginCredential -InformationAction Ignore | out-null;")).toBeTruthy();
|
expect(loginScript.includes("$psLoginSecrets = ConvertTo-SecureString 'client-se''cret' -AsPlainText -Force; $psLoginCredential = New-Object System.Management.Automation.PSCredential('client-id', $psLoginSecrets); Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -Credential $psLoginCredential | out-null;")).toBeTruthy();
|
||||||
expect(loginMethod).toBe('service principal with secret');
|
expect(loginMethod).toBe('service principal with secret');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -82,7 +82,7 @@ describe("Getting AzLogin PS script", () => {
|
|||||||
let loginConfig = new LoginConfig();
|
let loginConfig = new LoginConfig();
|
||||||
loginConfig.initialize();
|
loginConfig.initialize();
|
||||||
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
||||||
expect(loginScript.includes("$psLoginSecrets = ConvertTo-SecureString 'client-secret' -AsPlainText -Force; $psLoginCredential = New-Object System.Management.Automation.PSCredential('client-id', $psLoginSecrets); Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -Credential $psLoginCredential -InformationAction Ignore | out-null;")).toBeTruthy();
|
expect(loginScript.includes("$psLoginSecrets = ConvertTo-SecureString 'client-secret' -AsPlainText -Force; $psLoginCredential = New-Object System.Management.Automation.PSCredential('client-id', $psLoginSecrets); Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -Credential $psLoginCredential | out-null;")).toBeTruthy();
|
||||||
expect(loginMethod).toBe('service principal with secret');
|
expect(loginMethod).toBe('service principal with secret');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -100,7 +100,7 @@ describe("Getting AzLogin PS script", () => {
|
|||||||
loginConfig.initialize();
|
loginConfig.initialize();
|
||||||
jest.spyOn(loginConfig, 'getFederatedToken').mockImplementation(async () => {loginConfig.federatedToken = "fake-token";});
|
jest.spyOn(loginConfig, 'getFederatedToken').mockImplementation(async () => {loginConfig.federatedToken = "fake-token";});
|
||||||
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
||||||
expect(loginScript.includes("Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -ApplicationId 'client-id' -FederatedToken 'fake-token' -InformationAction Ignore | out-null;")).toBeTruthy();
|
expect(loginScript.includes("Connect-AzAccount -ServicePrincipal -Environment 'azurecloud' -Tenant 'tenant-id' -Subscription 'subscription-id' -ApplicationId 'client-id' -FederatedToken 'fake-token' | out-null;")).toBeTruthy();
|
||||||
expect(loginMethod).toBe('OIDC');
|
expect(loginMethod).toBe('OIDC');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -115,7 +115,7 @@ describe("Getting AzLogin PS script", () => {
|
|||||||
let loginConfig = new LoginConfig();
|
let loginConfig = new LoginConfig();
|
||||||
loginConfig.initialize();
|
loginConfig.initialize();
|
||||||
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
||||||
expect(loginScript.includes("Connect-AzAccount -Identity -Environment 'azurecloud' -Subscription 'subscription-id' -InformationAction Ignore | out-null;")).toBeTruthy();
|
expect(loginScript.includes("Connect-AzAccount -Identity -Environment 'azurecloud' -Subscription 'subscription-id' | out-null;")).toBeTruthy();
|
||||||
expect(loginMethod).toBe('system-assigned managed identity');
|
expect(loginMethod).toBe('system-assigned managed identity');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -130,7 +130,7 @@ describe("Getting AzLogin PS script", () => {
|
|||||||
let loginConfig = new LoginConfig();
|
let loginConfig = new LoginConfig();
|
||||||
loginConfig.initialize();
|
loginConfig.initialize();
|
||||||
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
||||||
expect(loginScript.includes("Connect-AzAccount -Identity -Environment 'azurecloud' -InformationAction Ignore | out-null;")).toBeTruthy();
|
expect(loginScript.includes("Connect-AzAccount -Identity -Environment 'azurecloud' | out-null;")).toBeTruthy();
|
||||||
expect(loginMethod).toBe('system-assigned managed identity');
|
expect(loginMethod).toBe('system-assigned managed identity');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -145,7 +145,7 @@ describe("Getting AzLogin PS script", () => {
|
|||||||
let loginConfig = new LoginConfig();
|
let loginConfig = new LoginConfig();
|
||||||
loginConfig.initialize();
|
loginConfig.initialize();
|
||||||
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
return AzPSSCriptBuilder.getAzPSLoginScript(loginConfig).then(([loginMethod, loginScript]) => {
|
||||||
expect(loginScript.includes("Connect-AzAccount -Identity -Environment 'azurecloud' -AccountId 'client-id' -InformationAction Ignore | out-null;")).toBeTruthy();
|
expect(loginScript.includes("Connect-AzAccount -Identity -Environment 'azurecloud' -AccountId 'client-id' | out-null;")).toBeTruthy();
|
||||||
expect(loginMethod).toBe('user-assigned managed identity');
|
expect(loginMethod).toBe('user-assigned managed identity');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1508
lib/main/index.js
1508
lib/main/index.js
File diff suppressed because it is too large
Load Diff
@@ -104,7 +104,7 @@ export default class AzPSScriptBuilder {
|
|||||||
if(subscriptionId){
|
if(subscriptionId){
|
||||||
loginCmdlet += `-Subscription '${subscriptionId}' `;
|
loginCmdlet += `-Subscription '${subscriptionId}' `;
|
||||||
}
|
}
|
||||||
loginCmdlet += `${cmdletSuffix} -InformationAction Ignore | out-null;`;
|
loginCmdlet += `${cmdletSuffix} | out-null;`;
|
||||||
return loginCmdlet;
|
return loginCmdlet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user