DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. PowerShell Script for Assigning Public IP Addresses to an Azure VM

PowerShell Script for Assigning Public IP Addresses to an Azure VM

We have a look at a Powershell script that will quickly assign a public IP to your Azure VM. Check it out!

Anindita Basak user avatar by
Anindita Basak
·
Jul. 27, 16 · Tutorial
Like (1)
Save
Tweet
Share
5.28K Views

Join the DZone community and get the full member experience.

Join For Free

Recently, Azure virtual machines provisioned with the 'Resource Manager/Classic' deployment model have been provisioned with virtual IP and dynamic IP addresses, but not public IP address. A public IP address is necessary for accessing services deployed on VM from a local browser.

For example, in an Azure Linux VM, if you provision Apache Hadoop/Hortonworks Data Platform/Cloudera Hadoop Distribution, you may need to access the Hadoop services from a local browser in those addresses, like the HDFS service (http://<ip address of VM>:50070 and http://<ip address of VM>:50075) and MapReduce Service (http://<ip address of VM>:8080), etc.

In order to assign public IP addresses for an Azure Linux VM , you need to execute the following PowerShell script:


Get-AzureVM -ServiceName ‘azfilestorage’ -Name ‘azfilestorage’ | Set-AzurePublicIP -PublicIPName ‘linuxvmip’ | Update-AzureVM

#Next, update the VM with SSH Port 22 so that the VM can be accessed through SSH.
Get-AzureVM -Name ‘azfilestorage’ -ServiceName ‘azfilestorage’ | Set-AzureEndpoint -Protocol tcp -Name ‘SSH’ -PublicPort 22 -LocalPort 22 | Update-AzureVM

PS


Next, you can check the public IP address on Azure Portal under the "IP Address" section of Azure Virtual Machine:

IP-addr


And there you have it. Your Azure VM is now provisioned with a public IP address.

Virtual Machine azure PowerShell

Published at DZone with permission of Anindita Basak, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Implementing Adaptive Concurrency Limits
  • A Simple Union Between .NET Core and Python
  • Best Practices for Writing Clean and Maintainable Code
  • Core Machine Learning Metrics

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: