Code Monkey home page Code Monkey logo

netappfiles-powershell-smb-script-sample's Introduction

page_type languages products description
sample
powershell
azure
azure-netapp-files
This project demonstrates how to use Powershell with NetApp Files SDK for Microsoft.NetApp resource provider to deploy SMB Volume.

Azure NetAppFiles SDK SMB Sample Powershell

This project demonstrates how to use Powershell with NetApp Files SDK for Microsoft.NetApp resource provider to deploy SMB Volume.

In this sample application we perform the following operations:

  • Creation

    • Azure NetApp Account
    • Capacity pool
    • SMB Volume
  • Deletion The clean-up process takes place, deleting all resources in the reverse order following the hierarchy. Otherwise we can't remove resources that have nested resources still live. (The clean-up proess is not enabled by default. You need to set the parameter CleanupResources to $true if you want the clean up code to take a place.)

If you don't already have a Microsoft Azure subscription, you can get a FREE trial account here.

Prerequisites

  1. Azure subscription.
  2. Subscription needs to have Azure NetApp Files resource provider registered. For more information, see Register for NetApp Resource Provider.
  3. Resource Group created.
  4. Virtual Network with a delegated subnet to Microsoft.Netapp/volumes resource. For more information, please refer to Guidelines for Azure NetApp Files network planning
  5. Azure PowerShell, please refer to Install Azure PowerShell
  6. Run the following PS command:
    • Install-Module Az.NetAppFiles
  7. Active Directory infrastructure setup with one or more DNS servers from the AD domain (usually the Domain Controllers) available in the same virtual network where you're setting up Azure NetApp Files. If you want to setup an Active Directory test environment, please refer to Create a new Windows VM and create a new AD Forest, Domain and DC for a quick setup, then you can work on the vnet that gets created to setup the subnet requirements for ANF.

How the project is structured

The following table describes all files within this solution:

Folder FileName Description
src CreateANFVolume.ps Authenticates and executes all operations
src\Common CommonOperations.psm1 PowerShell module that exposes some functions to perform creation and deletion Azure NetApp Files resource that calls the actual Az.NetAppFiles cmdlets
src\Common Utils.psm1 Static class that exposes a few methods that helps on various tasks, like writting a log to the console for example.
src\Common AzureAuth.psm1 PoweShell module that exposes functions to connect to Azure and choose target subscription

How to run the PowerShell script

  1. Clone the script locally:

    git clone https://github.com/Azure-Samples/netappfiles-powershell-nfs-sdk-sample.git
  2. Modes: There are two options to run the script:

    Basic mode - Single script create Azure NetApp files with no validation.

    • Change folder to netappfiles-powershell-smb-script-sample\src\Basic
    • Open CreateANFVolume and edit all the parameters
    • Save and close
    • Run the following command
    CreateANFVolume.ps1

    OR

    Advanced mode - More advanced way to run the script to create Azure Netapp Files with validation using modules

    • Change folder to netappfiles-powershell-smb-script-sample\src\Advanced
    • Change values bewtween brackets [ ] below and then run the command
    CreateANFVolume.ps1 -SubscriptionId '[subscriptionId]' -ResourceGroupName '[Azure Resource Group Name]' -Location '[Azure Location]' -NetAppAccountName '[ANF Account Name]' -NetAppPoolName '[ANF Capacity Pool Name]' -ServiceLevel [Ultra,Premium, Standard] -NetAppVolumeName '[ANF Volume Name]' -SubnetId '[Subnet ID] -DomainJoinUsername '[Username]' -DomainJoinPassword '[Password]' -DNSList 'DNS List' -ADFQDN 'Domain Name' -SmbServerNamePrefix 'SMB Server Name'

    Note: The below table shows all the mandatory and optional parameters

    Parameter Mandatory Default Value
    -SubscriptionId Yes
    -ResourceGroupName Yes
    -Location Yes
    -NetAppAccountName Yes
    -NetAppPoolName Yes
    -ServiceLevel Yes
    -NetAppPoolSize No 4398046511104
    -NetAppVolumeName Yes
    -ProtocolType Yes
    -NetAppVolumeSize No 107374182400
    -SubnetId Yes
    -DomainJoinUsername Yes
    -DomainJoinPassword Yes
    -DNSList Yes
    -ADFQDN Yes
    -SmbServerNamePrefix Yes
    -CleanupResources No False

    Sample output e2e execution

Troubleshoot

If you encounter the below issue when running the PoweShell command:

.\CreateANFVolume.ps1 : .\CreateANFVolume.ps1 cannot be loaded. The file .\CreateANFVolume.ps1 is not digitally signed. You cannot 
run this script on the current system.

Run the following command: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass

References

netappfiles-powershell-smb-script-sample's People

Contributors

adelghabb avatar adelghabboun avatar b-hchen avatar microsoft-github-operations[bot] avatar microsoftopensource avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netappfiles-powershell-smb-script-sample's Issues

ACTION REQUIRED: Microsoft needs this private repository to complete compliance info

There are open compliance tasks that need to be reviewed for your netappfiles-powershell-smb-script-sample repo.

Action required: 4 compliance tasks

To bring this repository to the standard required for 2021, we require administrators of this and all Microsoft GitHub repositories to complete a small set of tasks within the next 60 days. This is critical work to ensure the compliance and security of your Azure-Samples GitHub organization.

Please take a few minutes to complete the tasks at: https://repos.opensource.microsoft.com/orgs/Azure-Samples/repos/netappfiles-powershell-smb-script-sample/compliance

  • The GitHub AE (GitHub inside Microsoft) migration survey has not been completed for this private repository
  • No Service Tree mapping has been set for this repo. If this team does not use Service Tree, they can also opt-out of providing Service Tree data in the Compliance tab.
  • No repository maintainers are set. The Open Source Maintainers are the decision-makers and actionable owners of the repository, irrespective of administrator permission grants on GitHub.
  • Classification of the repository as production/non-production is missing in the Compliance tab.

You can close this work item once you have completed the compliance tasks, or it will automatically close within a day of taking action.

If you no longer need this repository, it might be quickest to delete the repo, too.

GitHub inside Microsoft program information

More information about GitHub inside Microsoft and the new GitHub AE product can be found at https://aka.ms/gim.

FYI: current admins at Microsoft include @shanemkm, @Phil-Jensen, @leonardbf, @haukurstefansson, @paulomarquesc, @audunn, @AdelGhabboun, @lichunli-ms

[Action Needed] This repo is inactive

This GitHub repository has been identified as a candidate for archival

This repository has had no activity in more than [x amount of time]. Long periods of inactivity present security and code hygiene risks. Archiving will not prevent users from viewing or forking the code. A banner will appear on the repository alerting users that the repository is archived.

Please see https://aka.ms/sunsetting-faq to learn more about this process.

Action

✍️

❗**If this repository is still actively maintained, please simply close this issue. Closing an issue on a repository is considered activity and the repository will not be archived.🔒

If you take no action, this repository is still inactive 30 days from today it will be automatically archived..

Need more help? 🖐️

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.