# ์›๊ฒฉ ์‹คํ–‰

# ์›๊ฒฉ

http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_QnA_etc&no=5258&z=

# ์›๊ฒฉ๊ด€๋ จ ์˜ค๋ฅ˜ ์ฐธ์กฐ

https://m.blog.naver.com/PostView.nhn?blogId=sung487&logNo=221042683798&proxyReferer=https%3A%2F%2Fwww.google.com%2F

# ์›๊ฒฉ PowerShell :

1) Enable-PSRemoting
2)Azure์™€ ์›๊ฒฉ๋ฐฉํ™”๋ฒฝ์˜ ์ธ๋ฐ”์šด๋“œ ํฌํŠธ 5985,5986 ๊ฐœ๋ฐฉ

# ๋กœ์ปฌ PowerShell:

1)winrm quickconfig --force

2)winrm get winrm/config/client

3)ํŠน์ • IP์— ์ ‘์†ํ•˜๋Š” ๊ฒƒ์„ ํ—ˆ์šฉ
-- ํŠน์ • IPํ—ˆ์šฉ
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "52.141.18.204"
-- ์ „์ฒด ํ—ˆ์šฉ
Set-Item WSMan:\localhost\Client\TrustedHosts -Value *

4)์ž๋™์ ‘์†์„ ํ•˜๊ธฐ ์œ„ํ•œ ์„ธํŒ…
$MyCredential = Get-Credential "f5074"
$MyPassword = Read-Host "Password" -AsSecureString | ConvertFrom-SecureString
$MyPassword = $MyPassword | ConvertTo-SecureString
$ObjectTypeName = "System.Management.Automation.PSCredential"
$MyCredential = New-Object -TypeName $ObjectTypeName -ArgumentList "f5074",$MyPassword


5)
-- ์ง์ ‘์ ‘์†ํ•ด์„œ ํ™•์ธ
Enter-PSSession -ComputerName "52.141.18.204" -Credential $MyCredential

-- ํŠน์ • ๋ช…๋ น์–ด๋งŒ ์‹คํ–‰
Invoke-Command -ComputerName "52.141.18.204" -credential $MyCredential -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'taskkill /im node.exe /f'"}
Invoke-Command -ComputerName "52.141.18.204" -credential "f5074" -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'C:\inetpub\ftproot\stop_sv.bat'"}

--Commit&Push git
Invoke-Command -ComputerName "52.141.18.204" -credential "f5074" -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'C:\inetpub\ftproot\start_commit_git.bat'"}

--pull git
Invoke-Command -ComputerName "52.141.18.204" -credential "f5074" -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'C:\inetpub\ftproot\start_pull_git.bat'"}

-- ์„œ๋ฒ„ ์ข…๋ฃŒ
Invoke-Command -ComputerName "52.141.18.204" -credential "f5074" -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'C:\inetpub\ftproot\stop_sv.bat'"}
Invoke-Command -ComputerName "52.141.18.204" -credential $MyCredential -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'taskkill /im node.exe /f'"}

-- ์„œ๋ฒ„ ์žฌ์‹œ์ž‘
Invoke-Command -ComputerName "52.141.18.204" -credential "f5074" -ErrorAction Stop -ScriptBlock {Invoke-Expression -Command:"cmd.exe /c 'C:\inetpub\ftproot\start_sv.bat'"}

-- ํ™•์ธ
f5074.koreacentral.cloudapp.azure.com:4200

# ๋ณด์•ˆ ๊ทธ๋ฃน ๊ทœ์น™์— ์˜ํ•ด ์ฐจ๋‹จ๋œ ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ: DefaultRule_DenyAllInBound

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

# references

https://community.spiceworks.com/topic/2242211-azure-nsg-rdp

https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-5.9.0
Last Updated: 4/13/2025, 11:14:44 PM